diff --git a/package.json b/package.json index 63048b6..530d05e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swagger-node-runner", - "version": "0.7.3", + "version": "0.8.0", "description": "Swagger loader and middleware utilities", "keywords": [ "swagger", @@ -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": { diff --git a/test/assets/project/api/swagger/swagger.yaml b/test/assets/project/api/swagger/swagger.yaml index 377651b..c4ddb78 100644 --- a/test/assets/project/api/swagger/swagger.yaml +++ b/test/assets/project/api/swagger/swagger.yaml @@ -8,6 +8,9 @@ schemes: - http consumes: - application/json + - text/plain + - multipart/form-data + - application/x-www-form-urlencoded produces: - application/json paths: @@ -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: @@ -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: @@ -365,7 +368,7 @@ paths: default: description: Error schema: - $ref: "#/definitions/ErrorResponse" + $ref: "#/definitions/ErrorResponse" definitions: HelloWorldResponse: diff --git a/test/lib/common.js b/test/lib/common.js index 76ee74a..5e64ae6 100644 --- a/test/lib/common.js +++ b/test/lib/common.js @@ -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) { @@ -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(); });