Skip to content

Commit

Permalink
use a different approach for http_head example in readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tbussmann committed Oct 27, 2016
1 parent c154e5a commit fcc35a5
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,17 @@ To access binary content, you must coerce the content from the default `varchar`
--------------+---------------+----------------
image/gif | 31958 | 31958

To access only the header you can do a HEAD-Request. This will not follow redirections.
To access only the headers you can do a HEAD-Request. This will not follow redirections.

WITH
http AS (
SELECT * FROM http_head('http://google.com')
),
headers AS (
SELECT (unnest(headers)).* FROM http
)
SELECT
http.status,
headers.value AS location
FROM http
LEFT OUTER JOIN headers
ON (headers.field = 'Location');
http.status,
headers.value AS location
FROM
http_head('http://google.com') AS http
LEFT OUTER JOIN LATERAL (SELECT value
FROM unnest(http.headers)
WHERE field = 'Location') AS headers
ON true;

status | location
--------+-----------------------------------------------------------
Expand Down

0 comments on commit fcc35a5

Please sign in to comment.