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

core: http - HttpClient does not encode '+' char properly (known bug) #1130

Closed
christophercr opened this issue Feb 12, 2019 · 1 comment · Fixed by #1132
Closed

core: http - HttpClient does not encode '+' char properly (known bug) #1130

christophercr opened this issue Feb 12, 2019 · 1 comment · Fixed by #1132

Comments

@christophercr
Copy link
Collaborator

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

The + char is not correctly encoded in the query string of the URL of the HTTP call.

This is already a known bug in the Angular HttpClient: angular/angular#18261 and angular/angular#11058 which remain open for the last couple of years.

Expected behavior

The URL of every HTTP call should be correctly encoded.

Minimal reproduction of the problem with instructions

  • Trigger an HTTP request with a query parameter with a date string. For example: dateFrom:2018-01-01T00:00:00+01:00
  • The HTTP call should have the parameter encoded as: dateTo=2018-01-01T00:00:00%2B01:00 but it is not encoded at all: dateFrom=2018-01-01T00:00:00+01:00 . The + is not encoded.

What is the motivation / use case for changing the behavior?

Respect Http standards.

Environment


Angular version: 7.2.3
Stark version: 10.0.0-beta.3

@christophercr christophercr changed the title core: http - HttpClient does not encode certain '+' char properly (known bug) core: http - HttpClient does not encode '+' char properly (known bug) Feb 12, 2019
@christophercr
Copy link
Collaborator Author

The solution suggested in the threads is to create a HttpParameterCodec.

So we should implement that in stark-core.

@christophercr christophercr added this to the 10.0.0-beta.4 milestone Feb 12, 2019
@carlo-nomes carlo-nomes self-assigned this Feb 12, 2019
carlo-nomes added a commit to carlo-nomes/stark that referenced this issue Feb 13, 2019
  - extracted `convertMapIntoObject` function to separate file
  - added `convertStarkQueryParamsIntoHttpParams` function to correctly handle params in the http module
  - extended `HttpParameterCodec` according to (this solution)[angular/angular#18261 (comment)]
  - updated `http-helpers.spec.ts` according to new implementation
  - test `convertStarkQueryParamsIntoHttpParams`

ISSUES CLOSED: NationalBankBelgium#1130
carlo-nomes added a commit to carlo-nomes/stark that referenced this issue Feb 13, 2019
  - extracted `convertMapIntoObject` function to separate file
  - added `convertStarkQueryParamsIntoHttpParams` function to correctly handle params in the http module
  - extended `HttpParameterCodec` according to (this solution)[angular/angular#18261 (comment)]
  - updated `http-helpers.spec.ts` according to new implementation
  - test `convertStarkQueryParamsIntoHttpParams`

ISSUES CLOSED: NationalBankBelgium#1130
carlo-nomes added a commit to carlo-nomes/stark that referenced this issue Feb 13, 2019
  - extracted `convertMapIntoObject` function to separate file
  - added `convertStarkQueryParamsIntoHttpParams` function to correctly handle params in the http module
  - extended `HttpParameterCodec` according to (this solution)[angular/angular#18261 (comment)]
  - updated `http-helpers.spec.ts` according to new implementation
  - test `convertStarkQueryParamsIntoHttpParams`

ISSUES CLOSED: NationalBankBelgium#1130
carlo-nomes added a commit to carlo-nomes/stark that referenced this issue Feb 13, 2019
  - added `http-util` as util for http module
    - added `convertStarkQueryParamsIntoHttpParams` function to correctly handle params in the http module
    - test `http-util`
  - extracted `convertMapIntoObject` function to separate helper file
  - added `StarkHttpParameterCodec` as fix
    - see: angular/angular#18261 (comment)
  - updated tests in `http.service.spec.ts` according to new implementation

ISSUES CLOSED: NationalBankBelgium#1130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants