fix: accepting cookies with request (required for sites like

nytimes.com)
pull/1/head
Adam Pash 8 years ago
parent 74694ba8e2
commit 8fe3bec6b6

@ -22,5 +22,12 @@ describe('Iris', function() {
// console.log(result)
})
it('does the nyt', async function() {
const result = await Iris.parse('http://www.nytimes.com/2016/08/16/upshot/the-state-of-the-clinton-trump-race-is-it-over.html?_r=0')
// console.log(result)
})
})
})

@ -21,9 +21,13 @@ export default async function fetchResource(url) {
const options = {
url: parsedUrl,
headers: REQUEST_HEADERS,
headers: { ...REQUEST_HEADERS },
timeout: FETCH_TIMEOUT,
// Don't set encoding; this fixes issues
// w/gzipped responses
encoding: null,
// Accept cookies
jar: true,
}
const { response, body } = await get(options)

@ -16,6 +16,13 @@ describe('fetchResource(url)', function() {
assert.equal(typeof body, 'object')
})
it('fetches nyt', async () => {
const url = 'http://www.nytimes.com/2016/08/16/upshot/the-state-of-the-clinton-trump-race-is-it-over.html?_r=0'
const { body, response } = await fetchResource(url)
assert.equal(typeof body, 'object')
})
})
describe('validateResponse(response)', () => {

Loading…
Cancel
Save