markfinger / python-react

Server-side rendering of React components
MIT License
1.62k stars 116 forks source link

Add ability to pass additional request headers to render server #64

Closed benmvp closed 8 years ago

benmvp commented 8 years ago

At Eventbrite we're building a Node render server to connect with our Django backend. We need to pass the language from Django to Node. The API of the server expects the language to be passed in the request headers as Accept-Language.

python-react passes the request header for the Content-type, but doesn't provide a facility to add additional request headers. This PR does that. While it is a change to the API, it should be backwards compatible since it's an additional defaulted parameter (request_headers). However, I imagine that anyone who has created their own renderer would have to update the API so that it accepts this 4th parameter.

I added a test as well as updated the relevant documentation. We are currently pointing to my fork, but would love for this change to be folded back in and published to NPM.

Let me know if you need any updates!

markfinger commented 8 years ago

Cool. Thanks for that!

markfinger commented 8 years ago

That's been pushed to PyPI. Thanks again!

benmvp commented 8 years ago

Awesome!