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

No way to retrieve response headers from RelayDefaultNetworkLayer #1123

Closed
03eltond opened this issue May 6, 2016 · 2 comments
Closed

No way to retrieve response headers from RelayDefaultNetworkLayer #1123

03eltond opened this issue May 6, 2016 · 2 comments

Comments

@03eltond
Copy link

03eltond commented May 6, 2016

When using relay server side, we can send request headers via init, but since there is no browser to pick up any Set-Cookie headers in the response, a custom network layer is required to proxy them over to the client. This is OK, but it seems clear to me there is some intention on allowing the RelayDefaultNetworkLayer to send contextual headers, and so it feels reasonable to me that perhaps it should also provide a mechanism for retrieving headers from the back end.

I would be happy to propose a pull request if this seems reasonable, though am unsure what the best route to take would be. The problem currently is that the internal fetch promise chains resolve with only the body data here and here, and so the header data is lost. A solution could be to include the header data in the resolves and make sure it gets made available to the consumer.

Of course, you can just tell me this is beyond the scope of the default network layer and I'll happily write my own, but thought it might be worth discussing as I wonder if it could become a common use case for those of us writing isomorphic apps :)

Thanks!

@wincent
Copy link
Contributor

wincent commented May 6, 2016

In general I think we want to keep the default layer pretty simple, and the intention is that if you want to do anything "special" you can bring your own.

Here is a similar issue from a day or two ago, which includes an interesting comment from @KyleAMathews to a user-space network layer project.

@03eltond
Copy link
Author

03eltond commented May 6, 2016

Thanks @wincent for pointing me in that direction. The idea of using middleware within the network layer is an interesting one that might work out well for us, or at least we can get some good ideas from that implementation. I'll go ahead and close this since it sounds like a custom layer is the way to go. Thanks again!

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

No branches or pull requests

2 participants