-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore content-type comparison when spec does not define it.
This is an attempt to make content-type matching less strict. Refer to issue #136
- Loading branch information
Showing
6 changed files
with
159 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var helper = require('../lib'); | ||
var request = helper.getRequest(); | ||
|
||
describe('Simple-API', function(){ | ||
before(function (done) { | ||
helper.drakov.run({sourceFiles: 'test/example/md/content-type.md'}, done); | ||
}); | ||
|
||
after(function (done) { | ||
helper.drakov.stop(done); | ||
}); | ||
|
||
describe('/api/content-type', function(){ | ||
describe('GET', function(){ | ||
it('should ignore content-type check when spec does not define it', function(done){ | ||
request.get('/api/content-type') | ||
.set('Content-type', 'application/json') | ||
.send({some: 'thing'}) | ||
.expect(200) | ||
.expect('Content-type', 'application/json;charset=UTF-8') | ||
.expect({response: 'ha'}) | ||
.end(helper.endCb(done)); | ||
}); | ||
}); | ||
|
||
describe('POST', function(){ | ||
it('should ignore content-type check when spec does not define it', function(done){ | ||
request.post('/api/content-type') | ||
.set('Content-type', 'application/json') | ||
.send({some: 'thing'}) | ||
.expect(200) | ||
.expect('Content-type', 'application/json;charset=UTF-8') | ||
.expect({response: 'ha'}) | ||
.end(helper.endCb(done)); | ||
}); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FORMAT: 1A | ||
|
||
# Requests without content-type | ||
|
||
## Content type API [/api/content-type] | ||
|
||
### Get some stuff [GET] | ||
|
||
+ Response 200 (application/json;charset=UTF-8) | ||
|
||
+ Body | ||
|
||
{ | ||
"response": "ha" | ||
} | ||
### Create some stuff [POST] | ||
|
||
+ Response 200 (application/json;charset=UTF-8) | ||
|
||
+ Body | ||
|
||
{ | ||
"response": "ha" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters