Query variables parameter is badly serialized when using GET method in production
See original GitHub issueIntended outcome:
I would like to use a GET method to allow query caching using httpLink.create({uri, method: 'GET'})
Actual outcome:
This works correctly for development with ng serve
but when built for production or using ng serve --prod
the variables query parameter is serialized as [object Object]
instead of {"currency":"USD"}
I can see there is a test assertion but I’m not too sure how it can be executed with production optimizations: https://github.com/apollographql/apollo-angular/blob/d185116b2d2306a40b12db747a058621211e2e92/packages/apollo-angular-link-http/tests/HttpLink.spec.ts#L205
How to reproduce the issue:
Example: https://github.com/mrfoster/ng-apollo-link-bug-1
Steps to recreate:
ng new apollo-angular-test
ng add apollo-angular
- Change the line in
graphql.module.ts
fromhttpLink.create({uri})
tohttpLink.create({uri, method: 'GET'})
- Create a query that accepts variables
query Rates($currency: String!) {
rates(currency: $currency) {
currency
rate
}
}
- Start using
ng serve --prod
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Wrong Query parameter serialization when using Object #8615
We are using objects in query parameters for a get operations, when we call the service, object parameters are not serialized as expected....
Read more >OpenAPI query string parameter with list of objects
and contains a list of object with properties id and value . My yaml documentation looks like the following parameters: - name: filtered...
Read more >Parameter Serialization - Swagger
Parameter Serialization · style defines how multiple values are delimited. Possible styles depend on the parameter location – path, query, header or cookie....
Read more >Guide to Spring Boot REST API Error Handling - Toptal
Implement consumer-friendly support to a Spring Boot REST API by hiding implementation details and delivering easily digestible fields.
Read more >Customizing the ReSTful interface - Flask-Restless
All endpoints which respond with data respond with serialized JSON strings. GET ... For more information on search parameters, see Making search queries....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kamilkisiela It was nothing to do with name mangling. The optimisations seemed to simply remove these lines: https://github.com/apollographql/apollo-angular/blob/b9ee478b56aa7448617c9aa4d47efac4ab43dca6/packages/apollo-angular-link-http-common/src/utils.ts#L34-L38
Please bump
apollo-angular-link-http-common
to1.5.1
, it contains a fix