Skip to content

Commit

Permalink
Update README.md - update domain for Httpbun
Browse files Browse the repository at this point in the history
It looks like the domain for the Httpbun service changed from httpbun.org to httpbun.com

Reference:

- https://httpbun.com
- https://github.com/sharat87/httpbun

Also, there are 2 example where a request is made for the "root path" (`http_get('http://httpbun.com/')`). These API endpoint doesn't seem to be working, but I haven't updated it.
  • Loading branch information
paulovieira authored Jan 19, 2024
1 parent 6de3b67 commit 9b7a8aa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Run a GET request and see the content.

```sql
SELECT content
FROM http_get('http://httpbun.org/ip');
FROM http_get('http://httpbun.com/ip');
```
```
content
Expand All @@ -53,7 +53,7 @@ Run a GET request with an Authorization header.
SELECT content::json->'headers'->>'Authorization'
FROM http((
'GET',
'http://httpbun.org/headers',
'http://httpbun.com/headers',
ARRAY[http_header('Authorization','Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9')],
NULL,
NULL
Expand All @@ -70,7 +70,7 @@ Read the `status` and `content` fields out of a `http_response` object.

```sql
SELECT status, content_type
FROM http_get('http://httpbun.org/');
FROM http_get('http://httpbun.com/');
```
```
status | content_type
Expand All @@ -83,7 +83,7 @@ Show all the `http_header` in an `http_response` object.

```sql
SELECT (unnest(headers)).*
FROM http_get('http://httpbun.org/');
FROM http_get('http://httpbun.com/');
```
```
field | value
Expand All @@ -105,7 +105,7 @@ Use the PUT command to send a simple text document to a server.

```sql
SELECT status, content_type, content::json->>'data' AS data
FROM http_put('http://httpbun.org/put', 'some text', 'text/plain');
FROM http_put('http://httpbun.com/put', 'some text', 'text/plain');
```
```
status | content_type | data
Expand All @@ -117,7 +117,7 @@ Use the PATCH command to send a simple JSON document to a server.

```sql
SELECT status, content_type, content::json->>'data' AS data
FROM http_patch('http://httpbun.org/patch', '{"this":"that"}', 'application/json');
FROM http_patch('http://httpbun.com/patch', '{"this":"that"}', 'application/json');
```
```
status | content_type | data
Expand All @@ -129,27 +129,27 @@ Use the DELETE command to request resource deletion.

```sql
SELECT status, content_type, content::json->>'url' AS url
FROM http_delete('http://httpbun.org/delete');
FROM http_delete('http://httpbun.com/delete');
```
```
status | content_type | url
--------+------------------+---------------------------
200 | application/json | http://httpbun.org/delete
200 | application/json | http://httpbun.com/delete
```

As a shortcut to send data to a GET request, pass a JSONB data argument.

```sql
SELECT status, content::json->'args' AS args
FROM http_get('http://httpbun.org/get',
FROM http_get('http://httpbun.com/get',
jsonb_build_object('myvar','myval','foo','bar'));
```

To POST to a URL using a data payload instead of parameters embedded in the URL, encode the data in a JSONB as a data payload.

```sql
SELECT status, content::json->'form' AS form
FROM http_post('http://httpbun.org/post',
FROM http_post('http://httpbun.com/post',
jsonb_build_object('myvar','myval','foo','bar'));
```

Expand Down Expand Up @@ -302,7 +302,7 @@ For such cases you can set the `CURLOPT_USERAGENT` option
SELECT http_set_curlopt('CURLOPT_USERAGENT',
'Examplebot/2.1 (+http://www.example.com/bot.html) Contact abuse@example.com');

SELECT status, content::json ->> 'user-agent' FROM http_get('http://httpbun.org/user-agent');
SELECT status, content::json ->> 'user-agent' FROM http_get('http://httpbun.com/user-agent');
```
```
status | user_agent
Expand Down

0 comments on commit 9b7a8aa

Please sign in to comment.