add support for res.json and binary data cache#66
Open
evanshortiss wants to merge 2 commits intorv-kip:masterfrom
Open
add support for res.json and binary data cache#66evanshortiss wants to merge 2 commits intorv-kip:masterfrom
evanshortiss wants to merge 2 commits intorv-kip:masterfrom
Conversation
Author
|
I believe this will fix:
The build is failing, but I can't see why. Should I be able to see the output? They pass locally so I'd need the Travis output to figure it out. |
| if (!err) { | ||
| /** Create the new cache **/ | ||
| self.add(name, buf, { | ||
| type: res._headers['content-type'], |
Author
There was a problem hiding this comment.
This might not be required now, since the content-type is stored in the body
Author
|
I created a new set of module to handle this since I needed more features, it's express-expeditious. Will leave this PR open in the event it is ever merged 👍 |
Owner
|
@evanshortiss, can you rebase and resolve conflicts? |
This was referenced Aug 10, 2018
Collaborator
|
@evanshortiss I understand this is old as hell but can you redo this PR for the dev branch? It would be greatly appreciated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently the module only caches on the use of res.send and has issues with binary files and JSON. This PR should help resolve such issues, but might need a little more work.
Tests now use supertest rather than a spawned process, I found this easier to work with. Let me know your thoughts!
Caching occurs on data passed to res.socket.write, not res.send now. This is is the main update that facilitates support for res.json and binary responses. Cached items now represent the data sent to the response stream too, so this is what gets written to the cache:
One potential issue is the Date header is cached; we might need to work around this?