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

HTTPMethod is empty #60

Open
brydavis opened this issue Mar 19, 2018 · 9 comments
Open

HTTPMethod is empty #60

brydavis opened this issue Mar 19, 2018 · 9 comments

Comments

@brydavis
Copy link

brydavis commented Mar 19, 2018

Tried to use the events.APIGatewayProxyRequest.HTTPMethod but it returned ""

Here's the full handler

func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
	fmt.Println("Received body: ", request.Body)
	switch request.HTTPMethod {
	case "POST":
		return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil
	default: // GET
		response := events.APIGatewayProxyResponse{
			Body:       request.QueryStringParameters["value"],
			StatusCode: 200,
		}
		return response, nil
	}
}
@ARolek
Copy link

ARolek commented May 2, 2018

I'm also encountering this issue, but only on the root ("/") requests. HTTPMethod is empty and so is the event.Path.

@brydavis
Copy link
Author

brydavis commented May 3, 2018

So, it works on all non-root paths? Interesting

@ARolek
Copy link

ARolek commented May 3, 2018

From my tests only root is causing a problem.

@baodinh
Copy link

baodinh commented Oct 9, 2018

any solution for this case ?

@petrogko
Copy link

Experiencing this issue right now.
request.HTTPMethod is empty and we have a resource (not root path).
This issue is old, so im wondering if a solution has been found... Any information on this would be awesome.

@Kiza
Copy link

Kiza commented Aug 6, 2020

I have the same issue ..

@lucianthorr
Copy link

I know this is an old thread but I found things worked when I changed to APIGatewayV2HTTPRequest
ie
func HandleRequest(ctx context.Context, req events.APIGatewayV2HTTPRequest)

@burgossrodrigo
Copy link

APIGatewayV2HTTPRequest worked for me aswell.

@adam-ah
Copy link

adam-ah commented Dec 28, 2024

Such a headbang... I went down the rabbit hole of trying to set up paths with proxy, only to learn this is just a damn bug in the framework.
Why do we have APIGatewayProxyRequest and HTTPMethod if it's non-functional?!

Pinging @bmoffatt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants