From 8bba8e50dab7cdffd6b193993745268156a96d83 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Wed, 30 Jan 2019 09:37:51 -0800 Subject: [PATCH] chore: add assertion for custom headers --- test/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/index.js b/test/index.js index 51d7796..86b3851 100644 --- a/test/index.js +++ b/test/index.js @@ -134,3 +134,13 @@ test('POST (string body w/ object url)', async t => { }); }); }); + +test('custom headers', async t => { + t.plan(2); + let headers = { 'X-FOO': 'BAR123' }; + let res = await httpie.get('https://reqres.in/api/users', { headers }); + let sent = res.req.getHeader('x-foo'); + + t.is(res.statusCode, 200, '~> statusCode = 200'); + t.is(sent, 'BAR123', '~> sent custom "X-FOO" header'); +});