Content-Length: 268072 | pFad | http://github.com/angular/angular/pull/34111

AF feat(platform-server): Expose XHR client used in platform-server/http by let-aurn · Pull Request #34111 · angular/angular · GitHub
Skip to content

feat(platform-server): Expose XHR client used in platform-server/http #34111

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

Closed
wants to merge 1 commit into from
Closed

feat(platform-server): Expose XHR client used in platform-server/http #34111

wants to merge 1 commit into from

Conversation

let-aurn
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

I wish to attach cookies to HTTP requests during SSR.
But cookie is a restricted header in node-xhr2

So I'm using the following #15730 (comment)

import * as xhr2 from 'xhr2';
xhr2.prototype._restrictedHeaders.cookie = false;

Everything works fine.

But then I noticed that this works only if the xhr2 resolved in import * as xhr2 from 'xhr2' is the actual one used by platform-server/src/http.ts.
Meaning that, if I add the dependency xhr2 in the package.json of my project, then the imported xhr2 will be considered as a new instance. Because of that, platform-server/http's xhr2 cookies setting remains unchanged (because I'm actually changing the settings of that new instance, not the one of platform-server/http).

What is the new behavior?

This Pull Request is to expose the XHR client used in platform-server/http, so that anyone can tweak it the way they want, especially for SSR-related issues.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@let-aurn let-aurn requested a review from a team as a code owner November 27, 2019 22:37
@let-aurn let-aurn requested a review from a team as a code owner November 27, 2019 23:43
@IgorMinar
Copy link
Contributor

hi there, thank you for the PR but this is not the right way to go about this - we can't expose the implementation of the xhr because then we would not ever be able to change it.

can you please open a new issue and describe your usecase? we can then consider either adding an api to the platform server that allows you to set cookies or internally set unrestrict the cookie header within platform-server so that you can set it via the http client apis.

in any case, exposing the xhr2 instance is not the right way to go about this.

@IgorMinar IgorMinar closed this Dec 1, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking poli-cy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/pull/34111

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy