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

GET requests seem to be parsing query params incorrectly #849

Closed
Tracked by #805
wesbillman opened this issue Jan 30, 2024 · 0 comments · Fixed by #860
Closed
Tracked by #805

GET requests seem to be parsing query params incorrectly #849

wesbillman opened this issue Jan 30, 2024 · 0 comments · Fixed by #860
Assignees
Labels
bug Something isn't working

Comments

@wesbillman
Copy link
Collaborator

This module:

type EchoRequest struct {
	Name string `json:"name"`
}

type EchoResponse struct {
	Message string `json:"message"`
}

//ftl:verb
//ftl:ingress http GET /idv/echo
func Echo(ctx context.Context, req builtin.HttpRequest[EchoRequest]) (builtin.HttpResponse[EchoResponse], error) {
	return builtin.HttpResponse[EchoResponse]{
		Status: 200,
		Body:   EchoResponse{Message: fmt.Sprintf("Hello, %s!", req.Body.Name)},
	}, nil
}

returns the error:

curl -i http://localhost:8892/ingress/idv/echo\?name\=wes
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Vary: Origin
X-Content-Type-Options: nosniff
Date: Tue, 30 Jan 2024 20:46:56 GMT
Content-Length: 94

builtin.HttpRequest<idv.EchoRequest>.body.name has wrong type, expected String found []string
@wesbillman wesbillman added the bug Something isn't working label Jan 30, 2024
@wesbillman wesbillman self-assigned this Jan 30, 2024
@github-project-automation github-project-automation bot moved this to Todo in FTL Jan 30, 2024
wesbillman added a commit that referenced this issue Jan 31, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in FTL Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant