X Tutup
The Wayback Machine - https://web.archive.org/web/20220321083530/https://github.com/angular/angular/pull/35829
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

fix(common): add HttpParamsOptions to the public api #35829

Conversation

rwlogel
Copy link

@rwlogel rwlogel commented Mar 3, 2020

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

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

What is the current behavior?

The HttpParamsOptions is not documented or included in the public API even though it is a constructor argument of HttpParams which is in the public API.

Issue Number: #20276

What is the new behavior?

HttpParamsOptions will be included in the public API and documented.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@googlebot
Copy link

@googlebot googlebot commented Mar 3, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@rwlogel rwlogel force-pushed the docs-common-add-http-params-options-to-public-api branch from 3a6ae72 to 22be818 Compare Mar 3, 2020
@googlebot
Copy link

@googlebot googlebot commented Mar 3, 2020

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Mar 3, 2020
IgorMinar
IgorMinar previously requested changes Mar 3, 2020
Copy link
Contributor

@IgorMinar IgorMinar left a comment

This is not a doc's change. Can you please change this comment to be a fix thank you

@rwlogel rwlogel force-pushed the docs-common-add-http-params-options-to-public-api branch from 22be818 to c387233 Compare Mar 3, 2020
@rwlogel rwlogel requested a review from IgorMinar Mar 3, 2020
@rwlogel rwlogel changed the title docs(common): add HttpParamsOptions to the public api fix(common): add HttpParamsOptions to the public api Mar 3, 2020
@gkalpak
Copy link
Member

@gkalpak gkalpak commented Mar 3, 2020

For context: #20332 and #23015

@rwlogel rwlogel force-pushed the docs-common-add-http-params-options-to-public-api branch from c387233 to faeebb9 Compare Mar 3, 2020
@rwlogel
Copy link
Author

@rwlogel rwlogel commented Mar 3, 2020

The reason I think we should expose the interface instead of making it inline as part of the HttpParams structure is because it makes extending HttpParams less complicated. This is the situation where I wanted to use it to work around #11058:

export class PlusSafeQueryEncoder implements HttpParameterCodec {
  encodeKey(key: string): string {
    return encodeURIComponent(key);
  }

  encodeValue(value: string): string {
    return encodeURIComponent(value);
  }

  decodeKey(key: string): string {
    return decodeURIComponent(key);
  }

  decodeValue(value: string): string {
    return decodeURIComponent(value);
  }
}

export class PlusSafeHttpParams extends HttpParams {
  constructor(options?: HttpParamsOptions = {} as HttpParamsOptions) {
    super({ ...options, encoder: new PlusSafeQueryEncoder() })
  }
}

@ngbot ngbot bot added this to the needsTriage milestone Mar 3, 2020
@gkalpak
Copy link
Member

@gkalpak gkalpak commented Mar 4, 2020

Sounds reasonable to me.

You can always grab the type from the HttpParams constructor, but it still sounds reasonable to use an interface:

type MyHttpParamsOptions = ConstructorParameters<typeof HttpParams>[0];

Copy link
Member

@jelbourn jelbourn left a comment

LGTM

Reviewed-for: public-api

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Thanks for updating this PR!

I've also checked that the HttpParamsOptions is displayed correctly (see here) and also started tests in Google's codebase (internal-only link).

Note: this PR should be ready for merge once all tests are completed and there is a final approval from the fw-http group (cc @alxhub).

Thank you.

alxhub
alxhub approved these changes Nov 10, 2020
alxhub
alxhub approved these changes Nov 10, 2020
Copy link
Contributor

@alxhub alxhub left a comment

Reviewed-For: public-api

@AndrewKushnir
Copy link
Contributor

@AndrewKushnir AndrewKushnir commented Nov 10, 2020

Started a new presubmit, will keep this thread updated.

@AndrewKushnir
Copy link
Contributor

@AndrewKushnir AndrewKushnir commented Nov 11, 2020

FYI, presubmit is successful for the changes in this PR. Thank you.

The `HttpParamsOptions` was not documented or included in the public API even
though it is a constructor argument of `HttpParams` which is a part of the
public API. This commit adds the `HttpParamsOptions` into the exports, thus
making it a part of the public API.

Resolves angular#20276
@atscott atscott force-pushed the docs-common-add-http-params-options-to-public-api branch from 51aad23 to d5e16ef Compare Nov 12, 2020
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Dec 19, 2020

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 policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 19, 2020
@ngbot ngbot bot removed this from the needsTriage milestone Dec 19, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

X Tutup