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

Default header for all requests #1170

Open
alishah730 opened this issue Jan 21, 2025 · 6 comments
Open

Default header for all requests #1170

alishah730 opened this issue Jan 21, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@alishah730
Copy link

I need to add a default header to all response
for example

response.headers({'custom-header': value})

is there any way we can this default to all API responses.?

thanks

@dethell
Copy link
Collaborator

dethell commented Jan 21, 2025

There's not something at present that allows you to add a default header to all responses.

@alishah730
Copy link
Author

There's not something at present that allows you to add a default header to all responses.

how do we request a feature?

@dethell
Copy link
Collaborator

dethell commented Jan 21, 2025

There's not something at present that allows you to add a default header to all responses.

how do we request a feature?

You just did! 👍

@pmcelhaney pmcelhaney added the enhancement New feature or request label Jan 21, 2025
@pmcelhaney
Copy link
Owner

pmcelhaney commented Jan 21, 2025

This should be possible once interceptors are implemented.

export const intercept: INTERCEPT = ($, respondTo, path, method) => {
  return respondTo($).header("custom-header", "value");
}

This is great timing, as I was already thinking about implementing interceptors this weekend.

@alishah730
Copy link
Author

alishah730 commented Jan 21, 2025

awesome, please add the header in allowed and exposed header as well.

Image

so far I can see : even I have added the header in response in its coming in browser but not exposed so angular httpheader not able to access the custom header.

when is the next release scheduled?

@pmcelhaney
Copy link
Owner

pmcelhaney commented Jan 22, 2025

Thanks! Can you open another issue explaining about the CORS headers in more detail?

There's no set release schedule, but I post a new release as soon as any non-trivial change is done. Hopefully I'll get your feature request and bug report both done and publish the next release this weekend.

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

No branches or pull requests

3 participants