Skip to content
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft.azure/autorest.testserver",
"version": "3.0.3",
"version": "3.0.4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably update that to 3.0.5 when you other PR merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i'm going to merge this one first, i'm leaving the other one on the back-burner for a bit, need to make some style changes to my autorest python pr for that, so I'm going to leave this one 3.04. thanks @timotheeguerin

"description": "Autorest test server.",
"main": "dist/cli/cli.js",
"bin": {
Expand Down
12 changes: 12 additions & 0 deletions src/test-routes/incorrect-error-response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { app, json } from "../api";
app.category("vanilla", () => {
app.get("/incorrectError", "verifyIncorrectErrorParsing", (req) => {
return {
status: 444,
body: {
contentType: "text/html",
rawContent: "foobar",
},
};
});
});
51 changes: 51 additions & 0 deletions swagger/incorrect-error-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"swagger": "2.0",
"info": {
"title": "Incorrect Returned Error Model",
"description": "Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors",
"version": "1.0.0"
},
"host": "localhost:3000",
"schemes": [
"http"
],
"produces": [
"text/html"
],
"consumes": [
"application/json"
],
"paths": {
"/incorrectError": {
"get": {
"operationId": "getIncorrectErrorFromServer",
"description": "Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users.",
"responses": {
"200": {
"description": "We will only return an error, so should expect a call to this service to fail."
},
"default": {
"description": "Error response from server. Will not abide by the defined Error model. Want to swallow the deserialization error and still return the overall HttpResponseError to users.",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Error": {
"type": "object",
"properties": {
"status": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}