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

feat: support net.http_delete with request body #173

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Dec 12, 2024

Addresses #77 (comment). Now it's possible to do:

select net.http_delete(
    url  :='http://localhost:8080/delete_w_body'
,   body := '{"key": "val"}'
);

Backwards compatibility is tested. No body will be sent if the body parameter is NULL (the default).

Notes

  • I tried adding an overloaded function for net.http_delete instead of modifying the existing one, but that caused breakage since every call like:
        select net.http_delete(
            url:='http://localhost:8080/delete'
        ,   params:= '{"param-foo": "bar"}'
        ,   headers:= '{"X-Baz": "foo"}'
        );

Failed with an error related to ambiguity (two functions with the same named parameters).

Prepares for adding a body parameter to the net.http_delete function.
@soedirgo
Copy link
Member

Let's only merge this after a migration file is added, otherwise pg_net.sql and the upgrade scripts go out of sync

Addresses supabase#77 (comment).
Now it's possible to do:

```sql
select net.http_delete(
    url  :='http://localhost:8080/delete_w_body'
,   body := '{"key": "val"}'
);
```

Backwards compatibility is tested. No body will be sent if
the body parameter is NULL (the default).
@steve-chavez
Copy link
Member Author

Ok then. I've added the migration file.

@steve-chavez steve-chavez requested review from soedirgo and removed request for soedirgo December 12, 2024 13:56
@steve-chavez steve-chavez merged commit d312525 into supabase:master Dec 12, 2024
7 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.

2 participants