Accept image/gif header added to gifler xhr request #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Gifs that are served by an AWS API Gateway Restapi require the Accept image/gif header in order to be properly decoded from base64.
If this header is not included, then the gif file returned is base64 and the whole function throws an invalid gif error.
Solution
We modify the Gifler function in
gifler.coffee
and add the request header just after opening the xhr request.Entry point was changed to
gifler.min.js
because that's the file that was passed through browserify.I also ran npm run build after making the change, however it seems that more changes happened in the output files than expected. I suspect some of the dependencies installed via npm i were newer and this is the cause.
Testing
I installed the application locally in my app using
npm install github:Roznoshchik/gifler
and was able to verify that the changes I made did not break the app in any of the functionality that I was using - which may not be a thorough enough test. But I don't see any unit tests for this app in the package.Notes
Feel free to close this PR if you want to implement the changes on your own, or also happy to make edits if you want to see something else.