Skip to content

fix(functions_client): use uppercase HTTP method in requests#1353

Merged
Vinzent03 merged 2 commits intosupabase:mainfrom
j8000:fix/uppercase-http-method
Apr 18, 2026
Merged

fix(functions_client): use uppercase HTTP method in requests#1353
Vinzent03 merged 2 commits intosupabase:mainfrom
j8000:fix/uppercase-http-method

Conversation

@j8000
Copy link
Copy Markdown
Contributor

@j8000 j8000 commented Apr 14, 2026

Summary

  • FunctionsClient.invoke() uses HttpMethod.name to set the HTTP method on requests, which returns lowercase ("post", "get", etc.)
  • While IOClient and CupertinoClient normalize methods to uppercase internally, CronetClient (recommended Android HTTP client from cronet_http) sends the method verbatim
  • The Supabase relay rejects lowercase methods with 400 Bad Request
  • Fix: call .toUpperCase() on method.name for both http.Request and http.MultipartRequest

Fixes #1352

Test plan

  • Call supabase.functions.invoke() with CronetClient as httpClient on Android — should no longer return 400
  • Verify existing behavior unchanged with IOClient and CupertinoClient

`HttpMethod.name` returns lowercase (`"post"`, `"get"`, etc.) which
violates RFC 7230. While IOClient and CupertinoClient normalize methods
internally, CronetClient (recommended Android HTTP client) sends the
method verbatim, causing Supabase relay to reject with 400 Bad Request.

Fixes supabase#1352
@Vinzent03
Copy link
Copy Markdown
Collaborator

@j8000 Thanks for opening the pull request. If you get to fix the tests since they are still wrongly expecting the lowercase version, this would be great.

Update assertions to match RFC 7230 uppercase method names now emitted
by FunctionsClient.invoke.
@j8000
Copy link
Copy Markdown
Contributor Author

j8000 commented Apr 17, 2026

@Vinzent03 Done - fixed the 4 assertions, all tests pass locally 👍

Copy link
Copy Markdown
Collaborator

@Vinzent03 Vinzent03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution.

@Vinzent03 Vinzent03 merged commit 61cc7c0 into supabase:main Apr 18, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FunctionsClient.invoke sends lowercase HTTP method, fails with CronetClient

2 participants