Skip to content

Commit 3ead394

Browse files
committed
Add test of Content-Type for unrecognized extension
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
1 parent e8e3655 commit 3ead394

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test-data/empty.txt

Whitespace-only changes.

test/swagger-spec-validator.js

+16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ var swaggerJsonPath =
2020
path.join(__dirname, '..', 'test-data', 'petstore-minimal.json');
2121
var swaggerYamlPath =
2222
path.join(__dirname, '..', 'test-data', 'petstore-minimal.yaml');
23+
var emptyPath =
24+
path.join(__dirname, '..', 'test-data', 'empty.txt');
2325

2426
function neverCalled() {
2527
throw new Error('should not be called');
@@ -360,6 +362,20 @@ describe('swaggerSpecValidator', function() {
360362
});
361363
});
362364

365+
// This may change in the future. Test to ensure header is reasonable.
366+
it('doesn\'t add Content-Type for other extensions', function() {
367+
var response = {};
368+
var ne = nock(defaultProtoHost)
369+
.matchHeader('Content-Type', undefined)
370+
.post(defaultUrl.path)
371+
.reply(200, response);
372+
return swaggerSpecValidator.validateFile(emptyPath)
373+
.then(function(result) {
374+
assert.deepEqual(result, response);
375+
ne.done();
376+
});
377+
});
378+
363379
it('does not change caller-provided Content-Type', function() {
364380
var response = {};
365381
var testType = 'text/plain';

0 commit comments

Comments
 (0)