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

[Question] Change headers of a deferred_response #278

Open
azertyalex opened this issue Aug 24, 2022 · 1 comment
Open

[Question] Change headers of a deferred_response #278

azertyalex opened this issue Aug 24, 2022 · 1 comment
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@azertyalex
Copy link

I am implementing a deferred_response. After reading the docs @ https://github.com/etr/libhttpserver/blob/master/README.md?plain=1#L632

It looks to me that I can not change headers or content-type after my deferred_response has been returned in the render function, I modify the object but I see no changes. It looks like a need more of a promise instead of a deferred response?

Is it in any way possible to set headers after render has been returned?

@azertyalex azertyalex added the bug Confirmed bugs or reports that are very likely to be bugs. label Aug 24, 2022
@etr
Copy link
Owner

etr commented Sep 1, 2022

This is as intended and it is an effect of the protocol (HTTP-1.1) not of the library. If you have already given the answer to your client, they've already received the headers. All you are doing with a deferred response is saying to them "I have more content here" but none of this content can override what you've already given to them (included the headers).

I hope this helps, but if you want to and can describe your use-case, I can see if there is a workaround in a way that is compatible with the protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

No branches or pull requests

2 participants