Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
wconti27 committed Feb 18, 2025
1 parent d821df7 commit e4c4494
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/datadog-plugin-http/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,20 @@ describe('Plugin', () => {
})
})
}

it('should record unfinished http requests as error spans', done => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('error', 1)
expect(traces[0][0].meta).to.not.have.property('http.status_code')
})
.then(done)
.catch(done)

http.request('https://httpbin.org/get', { headers: { BadHeader: 'a\nb' } }, res => {
res.on('data', () => { })
})
})
})

describe('with late plugin initialization and an external subscriber', () => {
Expand Down

0 comments on commit e4c4494

Please sign in to comment.