Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to sway 2 by bumping dep version and fixing tests #139

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-node-runner",
"version": "0.7.3",
"version": "0.8.0",
"description": "Swagger loader and middleware utilities",
"keywords": [
"swagger",
Expand Down Expand Up @@ -31,7 +31,7 @@
"multer": "^1.0.6",
"parseurl": "^1.3.0",
"qs": "^6.4.0",
"sway": "^1.0.0",
"sway": "^2.0.0",
"type-is": "^1.6.9"
},
"devDependencies": {
Expand Down
25 changes: 14 additions & 11 deletions test/assets/project/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ schemes:
- http
consumes:
- application/json
- text/plain
- multipart/form-data
- application/x-www-form-urlencoded
produces:
- application/json
paths:
Expand Down Expand Up @@ -321,8 +324,8 @@ paths:
get:
description: well, what do you know...
operationId: pipeInterface
responses:
200:
responses:
200:
description: Whatever
schema: {}
/controller_interface_auto_detected_as_middleware:
Expand All @@ -331,27 +334,27 @@ paths:
get:
description: well, what do you know...
operationId: middlewareInterface
responses:
200:
responses:
200:
description: Whatever
schema: {}
/controller_interface_on_path_cascades:
x-swagger-router-controller: overrides_ctrl_interface_pipe
x-controller-interface: pipe
get:
get:
operationId: pipeInterface
responses:
200:
responses:
200:
description: Whatever
schema: {}
/controller_interface_on_operation_cascades:
x-swagger-router-controller: overrides_ctrl_interface_pipe
x-controller-interface: pipe
get:
get:
x-controller-interface: middleware
operationId: middlewareInterface
responses:
200:
responses:
200:
description: Whatever
schema: {}
/controller_interface_pipe_operation_with_no_body:
Expand All @@ -365,7 +368,7 @@ paths:
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
$ref: "#/definitions/ErrorResponse"

definitions:
HelloWorldResponse:
Expand Down
7 changes: 4 additions & 3 deletions test/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ module.exports = function() {

it('should reject when invalid content', function(done) {
request(this.app)
.put('/expect_integer')
.set('Content-Type', 'text/plain')
.get('/hello_body')
.send('name=Scott')
.set('Content-Type', 'yolo/swag')
.expect(400)
.expect('Content-Type', /json/)
.end(function(err, res) {
Expand All @@ -214,7 +215,7 @@ module.exports = function() {
res.body.errors.should.be.an.Array;
res.body.errors[0].should.have.properties({
code: 'INVALID_CONTENT_TYPE',
message: 'Invalid Content-Type (text/plain). These are supported: application/json'
message: 'Invalid Content-Type (yolo/swag). These are supported: application/json, text/plain, multipart/form-data, application/x-www-form-urlencoded'
});
done();
});
Expand Down