Skip to content

Commit a83ca82

Browse files
committed
test(collector): added content-type header assertion
refs https://jsw.ibm.com/browse/INSTA-56944
1 parent a9f2f25 commit a83ca82

File tree

2 files changed

+5
-0
lines changed
  • packages/collector/test/tracing/protocols/http/server

2 files changed

+5
-0
lines changed

packages/collector/test/tracing/protocols/http/server/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ server.on('request', (req, res) => {
119119
function endResponse(query, res, body) {
120120
if (query.writeHead) {
121121
res.writeHead(200, {
122+
'content-type': 'text/plain',
122123
'X-WRITE-HEAD-RESPONSE-HEADER': 'Write Head Response Header Value',
123124
'x-write-head-response-multi-header': ['value1', 'value2'],
124125
'x-write-head-response-not-captured-header': "just don't"

packages/collector/test/tracing/protocols/http/server/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mochaSuiteFn('tracing/http(s) server', function () {
2626
await agentControls.startAgent({
2727
extraHeaders: [
2828
//
29+
'content-type',
2930
'X-My-Entry-Request-Header',
3031
'X-My-Entry-Request-Multi-Header',
3132
'X-My-Entry-Response-Header',
@@ -329,6 +330,7 @@ function registerTests(agentControls, appUsesHttps, useHttp2CompatApi) {
329330
const span = verifyThereIsExactlyOneHttpEntry(spans, controls, '/', 'GET', 200, false, false);
330331
expect(span.data.http.header).to.be.an('object');
331332
expect(span.data.http.header).to.deep.equal({
333+
'content-type': 'text/plain',
332334
'x-write-head-response-header': expectedResponeHeaderValue,
333335
'x-write-head-response-multi-header': 'value1, value2'
334336
});
@@ -397,6 +399,7 @@ function registerTests(agentControls, appUsesHttps, useHttp2CompatApi) {
397399
expect(span.data.http.header).to.be.an('object');
398400
if (this.title === 'http2 compat mode') {
399401
expect(span.data.http.header).to.deep.equal({
402+
'content-type': 'text/plain',
400403
'x-my-entry-request-header': requestHeaderValue,
401404
'x-my-entry-request-multi-header': 'value1, value2',
402405
'x-my-entry-response-header': expectedResponeHeaderValue1,
@@ -406,6 +409,7 @@ function registerTests(agentControls, appUsesHttps, useHttp2CompatApi) {
406409
});
407410
} else {
408411
expect(span.data.http.header).to.deep.equal({
412+
'content-type': 'text/plain',
409413
'x-my-entry-request-header': requestHeaderValue,
410414
'x-my-entry-request-multi-header': 'value1,value2',
411415
'x-my-entry-response-header': expectedResponeHeaderValue1,

0 commit comments

Comments
 (0)