Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Improve error handling, tests #53

Merged
merged 4 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions fixtures/main_error_response.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
interactions:
- request:
body: null
headers:
Content-Length:
- '0'
method: ''
uri: https://jsonplaceholder.typicode.com/
response:
body:
string: "<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n\
<center><h1>400 Bad Request</h1></center>\r\n<hr><center>cloudflare</center>\r\
\n</body>\r\n</html>\r\n"
headers:
CF-RAY:
- '-'
Connection:
- close
Content-Length:
- '155'
Content-Type:
- text/html
Date:
- Mon, 16 Dec 2019 22:11:39 GMT
Server:
- cloudflare
status:
code: 400
message: Bad Request
version: 1
59 changes: 59 additions & 0 deletions fixtures/main_input_body.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
interactions:
- request:
body: id=42&title=test
headers:
Content-Length:
- '16'
Content-Type:
- application/x-www-form-urlencoded
method: POST
uri: https://jsonplaceholder.typicode.com/posts
response:
body:
string: "{\n \"id\": 101,\n \"title\": \"test\"\n}"
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Expose-Headers:
- Location
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 546ab6213f81f11a-IAD
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '34'
Content-Type:
- application/json; charset=utf-8
Date:
- Tue, 17 Dec 2019 17:45:33 GMT
Etag:
- W/"22-i04alCk7PdGrJ2UKCUwBOO0LB3w"
Expect-CT:
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Expires:
- '-1'
Location:
- http://jsonplaceholder.typicode.com/posts/101
Pragma:
- no-cache
Server:
- cloudflare
Set-Cookie:
- __cfduid=d1fa880178dc2db917f26b8ce4e0d56e41576604733; expires=Thu, 16-Jan-20
17:45:33 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax
Vary:
- Origin, X-HTTP-Method-Override, Accept-Encoding
Via:
- 1.1 vegur
X-Content-Type-Options:
- nosniff
X-Powered-By:
- Express
status:
code: 201
message: Created
version: 1
94 changes: 94 additions & 0 deletions fixtures/main_input_headers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
interactions:
- request:
body: null
headers:
X-Test-Header:
- th
method: GET
uri: https://jsonplaceholder.typicode.com/posts?userId=1
response:
body:
string: "[\n {\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"sunt aut\
\ facere repellat provident occaecati excepturi optio reprehenderit\",\n \
\ \"body\": \"quia et suscipit\\nsuscipit recusandae consequuntur expedita\
\ et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem\
\ sunt rem eveniet architecto\"\n },\n {\n \"userId\": 1,\n \"id\"\
: 2,\n \"title\": \"qui est esse\",\n \"body\": \"est rerum tempore\
\ vitae\\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\\nfugiat\
\ blanditiis voluptate porro vel nihil molestiae ut reiciendis\\nqui aperiam\
\ non debitis possimus qui neque nisi nulla\"\n },\n {\n \"userId\":\
\ 1,\n \"id\": 3,\n \"title\": \"ea molestias quasi exercitationem repellat\
\ qui ipsa sit aut\",\n \"body\": \"et iusto sed quo iure\\nvoluptatem\
\ occaecati omnis eligendi aut ad\\nvoluptatem doloribus vel accusantium quis\
\ pariatur\\nmolestiae porro eius odio et labore et velit aut\"\n },\n {\n\
\ \"userId\": 1,\n \"id\": 4,\n \"title\": \"eum et est occaecati\"\
,\n \"body\": \"ullam et saepe reiciendis voluptatem adipisci\\nsit amet\
\ autem assumenda provident rerum culpa\\nquis hic commodi nesciunt rem tenetur\
\ doloremque ipsam iure\\nquis sunt voluptatem rerum illo velit\"\n },\n\
\ {\n \"userId\": 1,\n \"id\": 5,\n \"title\": \"nesciunt quas odio\"\
,\n \"body\": \"repudiandae veniam quaerat sunt sed\\nalias aut fugiat\
\ sit autem sed est\\nvoluptatem omnis possimus esse voluptatibus quis\\nest\
\ aut tenetur dolor neque\"\n },\n {\n \"userId\": 1,\n \"id\": 6,\n\
\ \"title\": \"dolorem eum magni eos aperiam quia\",\n \"body\": \"\
ut aspernatur corporis harum nihil quis provident sequi\\nmollitia nobis aliquid\
\ molestiae\\nperspiciatis et ea nemo ab reprehenderit accusantium quas\\\
nvoluptate dolores velit et doloremque molestiae\"\n },\n {\n \"userId\"\
: 1,\n \"id\": 7,\n \"title\": \"magnam facilis autem\",\n \"body\"\
: \"dolore placeat quibusdam ea quo vitae\\nmagni quis enim qui quis quo nemo\
\ aut saepe\\nquidem repellat excepturi ut quia\\nsunt ut sequi eos ea sed\
\ quas\"\n },\n {\n \"userId\": 1,\n \"id\": 8,\n \"title\": \"\
dolorem dolore est ipsam\",\n \"body\": \"dignissimos aperiam dolorem qui\
\ eum\\nfacilis quibusdam animi sint suscipit qui sint possimus cum\\nquaerat\
\ magni maiores excepturi\\nipsam ut commodi dolor voluptatum modi aut vitae\"\
\n },\n {\n \"userId\": 1,\n \"id\": 9,\n \"title\": \"nesciunt\
\ iure omnis dolorem tempora et accusantium\",\n \"body\": \"consectetur\
\ animi nesciunt iure dolore\\nenim quia ad\\nveniam autem ut quam aut nobis\\\
net est aut quod aut provident voluptas autem voluptas\"\n },\n {\n \"\
userId\": 1,\n \"id\": 10,\n \"title\": \"optio molestias id quia eum\"\
,\n \"body\": \"quo et expedita modi cum officia vel magni\\ndoloribus\
\ qui repudiandae\\nvero nisi sit\\nquos veniam quod sed accusamus veritatis\
\ error\"\n }\n]"
headers:
Access-Control-Allow-Credentials:
- 'true'
Age:
- '1789'
CF-Cache-Status:
- HIT
CF-RAY:
- 54722d954de5e0ea-IAD
Cache-Control:
- max-age=14400
Connection:
- keep-alive
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 18 Dec 2019 15:30:26 GMT
Etag:
- W/"aa6-j2NSH739l9uq40OywFMn7Y0C/iY"
Expect-CT:
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Expires:
- '-1'
Pragma:
- no-cache
Server:
- cloudflare
Set-Cookie:
- __cfduid=d21e159ad4987bc5ba9d781aed2f9db5c1576683026; expires=Fri, 17-Jan-20
15:30:26 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax
Transfer-Encoding:
- chunked
Vary:
- Origin, Accept-Encoding
Via:
- 1.1 vegur
X-Content-Type-Options:
- nosniff
X-Powered-By:
- Express
status:
code: 200
message: OK
version: 1
92 changes: 92 additions & 0 deletions fixtures/main_json_response.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
interactions:
- request:
body: null
headers: {}
method: GET
uri: https://jsonplaceholder.typicode.com/posts?userId=1
response:
body:
string: "[\n {\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"sunt aut\
\ facere repellat provident occaecati excepturi optio reprehenderit\",\n \
\ \"body\": \"quia et suscipit\\nsuscipit recusandae consequuntur expedita\
\ et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem\
\ sunt rem eveniet architecto\"\n },\n {\n \"userId\": 1,\n \"id\"\
: 2,\n \"title\": \"qui est esse\",\n \"body\": \"est rerum tempore\
\ vitae\\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\\nfugiat\
\ blanditiis voluptate porro vel nihil molestiae ut reiciendis\\nqui aperiam\
\ non debitis possimus qui neque nisi nulla\"\n },\n {\n \"userId\":\
\ 1,\n \"id\": 3,\n \"title\": \"ea molestias quasi exercitationem repellat\
\ qui ipsa sit aut\",\n \"body\": \"et iusto sed quo iure\\nvoluptatem\
\ occaecati omnis eligendi aut ad\\nvoluptatem doloribus vel accusantium quis\
\ pariatur\\nmolestiae porro eius odio et labore et velit aut\"\n },\n {\n\
\ \"userId\": 1,\n \"id\": 4,\n \"title\": \"eum et est occaecati\"\
,\n \"body\": \"ullam et saepe reiciendis voluptatem adipisci\\nsit amet\
\ autem assumenda provident rerum culpa\\nquis hic commodi nesciunt rem tenetur\
\ doloremque ipsam iure\\nquis sunt voluptatem rerum illo velit\"\n },\n\
\ {\n \"userId\": 1,\n \"id\": 5,\n \"title\": \"nesciunt quas odio\"\
,\n \"body\": \"repudiandae veniam quaerat sunt sed\\nalias aut fugiat\
\ sit autem sed est\\nvoluptatem omnis possimus esse voluptatibus quis\\nest\
\ aut tenetur dolor neque\"\n },\n {\n \"userId\": 1,\n \"id\": 6,\n\
\ \"title\": \"dolorem eum magni eos aperiam quia\",\n \"body\": \"\
ut aspernatur corporis harum nihil quis provident sequi\\nmollitia nobis aliquid\
\ molestiae\\nperspiciatis et ea nemo ab reprehenderit accusantium quas\\\
nvoluptate dolores velit et doloremque molestiae\"\n },\n {\n \"userId\"\
: 1,\n \"id\": 7,\n \"title\": \"magnam facilis autem\",\n \"body\"\
: \"dolore placeat quibusdam ea quo vitae\\nmagni quis enim qui quis quo nemo\
\ aut saepe\\nquidem repellat excepturi ut quia\\nsunt ut sequi eos ea sed\
\ quas\"\n },\n {\n \"userId\": 1,\n \"id\": 8,\n \"title\": \"\
dolorem dolore est ipsam\",\n \"body\": \"dignissimos aperiam dolorem qui\
\ eum\\nfacilis quibusdam animi sint suscipit qui sint possimus cum\\nquaerat\
\ magni maiores excepturi\\nipsam ut commodi dolor voluptatum modi aut vitae\"\
\n },\n {\n \"userId\": 1,\n \"id\": 9,\n \"title\": \"nesciunt\
\ iure omnis dolorem tempora et accusantium\",\n \"body\": \"consectetur\
\ animi nesciunt iure dolore\\nenim quia ad\\nveniam autem ut quam aut nobis\\\
net est aut quod aut provident voluptas autem voluptas\"\n },\n {\n \"\
userId\": 1,\n \"id\": 10,\n \"title\": \"optio molestias id quia eum\"\
,\n \"body\": \"quo et expedita modi cum officia vel magni\\ndoloribus\
\ qui repudiandae\\nvero nisi sit\\nquos veniam quod sed accusamus veritatis\
\ error\"\n }\n]"
headers:
Access-Control-Allow-Credentials:
- 'true'
Age:
- '4646'
CF-Cache-Status:
- HIT
CF-RAY:
- 54640259fa6fe0d2-IAD
Cache-Control:
- max-age=14400
Connection:
- keep-alive
Content-Type:
- application/json; charset=utf-8
Date:
- Mon, 16 Dec 2019 22:14:15 GMT
Etag:
- W/"aa6-j2NSH739l9uq40OywFMn7Y0C/iY"
Expect-CT:
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Expires:
- '-1'
Pragma:
- no-cache
Server:
- cloudflare
Set-Cookie:
- __cfduid=d8ac1a396d31b9e9c1f816924e5bf186d1576534455; expires=Wed, 15-Jan-20
22:14:15 GMT; path=/; domain=.typicode.com; HttpOnly
Transfer-Encoding:
- chunked
Vary:
- Origin, Accept-Encoding
Via:
- 1.1 vegur
X-Content-Type-Options:
- nosniff
X-Powered-By:
- Express
status:
code: 200
message: OK
version: 1
Loading