Comments (11)
There is a test that checks URL query encoding: https://github.com/apex/gateway/blob/master/request_test.go#L38
Are you sure the request itself isn't double encoded? Gateway should be properly decoding things AFAICT.
from gateway.
This test is testing the request with a prefilled APIGatewayProxyRequest object. The double encoding is happening because querystring is being encoded again before filling the APIGatewayProxyRequest:
Line 33 in 46d1104
from gateway.
I'm not sure I follow. RawQuery is supposed to have % stuff in it. If you want the version without % encoding, do u.Query().Get("phone")
.
It sounds like the issue is that the parameters are already percent encoded in APIGatewayProxyRequest, which AFAICT is wrong.
from gateway.
So let me explain it this way:
I have a url something.com
I want to send a phone number +919999999999
in the query string
The frontend encodes the url with query parameters on its end before making the request. The resulting url is:
https://something.com?phone=%2B919999999999
The NewRequest function reencodes this url making this:
https://something.com?phone=%252B919999999999
Now running u.Query().Get("phone")
will get me: %2B919999999999
instead of +919999999999
from gateway.
It sounds like the issue is that the parameters are already percent encoded in APIGatewayProxyRequest, which AFAICT is wrong.
From my understanding, the frontend does encode all query parameters before making the request which is the standard. That is why the inbuilt URL.Query() function in go's request library decodes them automatically.
from gateway.
Yes, the raw URL should have percentages in it. APIGatewayProxyRequest is not a raw URL. The percentages should already have been turned into decoded values when being added to event.QueryStringParameters by AWS itself. That's why they need to be reencoded for the Request.URL.
from gateway.
Just checked. They aren't being decoded by AWS.
from gateway.
I've been looking but can't find any documentation. Did you find AWS documentation? Or just do an experimental setup? If an experiment, what does you gateway look like?
from gateway.
I did an experimental setup. I don't use api gateway instead I have a load balancer that directly calls the lambda application via target groups
from gateway.
I think your LB needs to do the decoding then before it builds the JSON.
from gateway.
I don't think that can be done with AWS's ALBs. Does the api gateway decode the query string before making the request to lambda?
from gateway.
Related Issues (19)
- Toggle to fall back to http.ListenAndServe HOT 3
- 1.1 release? HOT 1
- Support for JSON API Content-Type HOT 1
- Support for multi-valued headers HOT 2
- Memory usage HOT 3
- Reordering query parameters. HOT 1
- Example in the README doesn't work HOT 1
- Is it possible to include assets in the binary? HOT 1
- Set request.RequestURI HOT 5
- Not compatible with gateway v2 HOT 10
- Lambda - using gateway 301 error HOT 3
- headers don't get written if no content or status is written HOT 1
- How to properly use apex/gatway ? HOT 1
- Maximum (50) redirects followed HOT 2
- This project could use some love... HOT 3
- API gateway resource does not pass into handler
- aws-lambda-go package need upgrade to v1.32.0, otherwise will not work! HOT 1
- Actually sniff content-type on write HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gateway.