You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flagon.apache.org by GitBox <gi...@apache.org> on 2021/05/05 21:51:46 UTC

[GitHub] [incubator-flagon-useralejs] UncleGedd opened a new pull request #91: Sendbeacon example fix

UncleGedd opened a new pull request #91:
URL: https://github.com/apache/incubator-flagon-useralejs/pull/91


   ## Fixes [Issue #65](https://github.com/apache/incubator-flagon-useralejs/issues/65)
   Basically, the issue is that `sendBeacon` POSTs data with `Content-Type:text/plain;charset=UTF-8` instead of `application/json`
   
   The problem and potential solutions are pretty well described in this [SO post](https://stackoverflow.com/questions/31355128/how-to-receive-data-posted-by-navigator-sendbeacon-on-node-js-server). In our case, two potential solutions are as follows:
   
   1. Server-side fix: Allow the Express server to parse text payloads and perform some logic to parse the `logs` queue out of the text payload when necessary. The downside is that the onus is on the user to check for text data on the backend
   2. Client-side fix: Use the `Blob` API to wrap `JSON.stringify(logs)` in the `sendBeacon` callback. The downside is that `Blob` is undefined in our test suite and would require a polyfill/mock
   
   This PR uses the first option as it was a quick and easy fix server-side. However, it's probably best to fix this using the second option so it doesn't affect users who may not be doing much processing on the server side


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-flagon-useralejs] UncleGedd closed pull request #91: Sendbeacon example fix

Posted by GitBox <gi...@apache.org>.
UncleGedd closed pull request #91:
URL: https://github.com/apache/incubator-flagon-useralejs/pull/91


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-flagon-useralejs] UncleGedd commented on pull request #91: Sendbeacon example fix

Posted by GitBox <gi...@apache.org>.
UncleGedd commented on pull request #91:
URL: https://github.com/apache/incubator-flagon-useralejs/pull/91#issuecomment-833832569


   The test I wrote for `sendBeacon` is failing in Node 15, will investigate.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-flagon-useralejs] UncleGedd commented on pull request #91: Sendbeacon example fix

Posted by GitBox <gi...@apache.org>.
UncleGedd commented on pull request #91:
URL: https://github.com/apache/incubator-flagon-useralejs/pull/91#issuecomment-840820263


   Changes included in this [PR](https://github.com/apache/incubator-flagon-useralejs/pull/105)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org