Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable .json file extension for json responses #53

Merged
merged 1 commit into from
Jul 19, 2020

Conversation

andypa
Copy link
Contributor

@andypa andypa commented Mar 23, 2020

To automatically set the correct content-type for application/json responses, check if the response is a JsonResponse and if so, create a .json file instead of a .html file.

I didn't write a test since I didn't know where to start to be honest.

It is not perfect since the ending "json" is hardcoded but in the future, the determineFileExtension method could be extended if needed.

Also, the forget method is not the most elegant with trying to delete either a .html or a .json file. If you have a better idea on how to solve that, please let me know and I'll try to rewrite it. I've chosen this way since at least in my applications, it's always either a html or json response which would benefit the most from the caching.

Cheers!

To automatically set the correct content-type for application/json responses, check if the response is a JsonResponse and if so, create a .json file instead of a .html file
@janbolat
Copy link

Would be a very nice addition!

@andypa
Copy link
Contributor Author

andypa commented Apr 21, 2020

Hi @JosephSilber

I hope you are doing well in these times. I was wondering if you think anything could be improved in the PR or if there is anything else I could do to get this merged. Let me know and I would look into it.

Stay safe!

Cheers,
Andy

@JosephSilber
Copy link
Owner

I was wondering if you think anything could be improved in the PR

I just didn't get a chance to dig in yet.

if there is anything else I could do

Not presently. I need to pull this down and play with it, but just didn't find the time yet.


Thanks for your patience 🙏

@JosephSilber JosephSilber merged commit 36f3057 into JosephSilber:master Jul 19, 2020
@JosephSilber
Copy link
Owner

JosephSilber commented Jul 19, 2020

Thanks for submitting this, and thanks again for your patience ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants