From b0dfab1fa2fae68a07464aac5f4de221f1cd5aaf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:12:50 +0000 Subject: [PATCH 1/4] Initial plan From a5b3379ae5576d21c22c5e96fd916963380f5861 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:45:25 +0000 Subject: [PATCH 2/4] Fix http-specs e2e test failures and exit code propagation - Fix validate-client-server script to properly propagate exit code - Fix Duration Header float scenarios: add missing request headers - Fix Multipart File upload scenarios: use proper multipart body - Fix Pageable XML content-type header to include charset=utf-8 - Fix Pageable XML listWithNextLink response body to use dynamic Resolver - Fix server-test.ts bug: compare resolved content (raw) not rawContent Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- packages/http-specs/package.json | 2 +- .../specs/encode/duration/mockapi.ts | 5 +++++ .../specs/payload/multipart/mockapi.ts | 21 +++++++++++-------- .../specs/payload/pageable/mockapi.ts | 17 ++++++++++----- packages/spector/src/actions/server-test.ts | 2 +- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/packages/http-specs/package.json b/packages/http-specs/package.json index 372bb5d077b..c1a95eaf74c 100644 --- a/packages/http-specs/package.json +++ b/packages/http-specs/package.json @@ -19,7 +19,7 @@ "upload-coverage": "tsp-spector upload-coverage --generatorName @typespec/http-specs --generatorVersion 0.1.0-alpha.4 --containerName coverages --generatorMode standard --storageAccountName typespec", "validate-mock-apis": "tsp-spector validate-mock-apis ./specs", "check-scenario-coverage": "tsp-spector check-coverage ./specs", - "validate-client-server": "concurrently \"tsp-spector server start ./specs\" \"pnpm knock\"; tsp-spector server stop", + "validate-client-server": "concurrently \"tsp-spector server start ./specs\" \"pnpm knock\"; code=$?; tsp-spector server stop; exit $code", "build:smoke": "tsp compile smoke/petstore --warn-as-error --no-emit && tsp compile smoke/todoapp --warn-as-error --no-emit", "client": "pnpm knock", "knock": "tsp-spector knock ./specs", diff --git a/packages/http-specs/specs/encode/duration/mockapi.ts b/packages/http-specs/specs/encode/duration/mockapi.ts index 6a722fff8ff..c74a77d300b 100644 --- a/packages/http-specs/specs/encode/duration/mockapi.ts +++ b/packages/http-specs/specs/encode/duration/mockapi.ts @@ -295,6 +295,11 @@ function createHeaderFloatServerTests(uri: string, value: number) { return passOnSuccess({ uri, method: "get", + request: { + headers: { + duration: String(value), + }, + }, response: { status: 204, }, diff --git a/packages/http-specs/specs/payload/multipart/mockapi.ts b/packages/http-specs/specs/payload/multipart/mockapi.ts index 3ac7dbda70a..70a8b4a3500 100644 --- a/packages/http-specs/specs/payload/multipart/mockapi.ts +++ b/packages/http-specs/specs/payload/multipart/mockapi.ts @@ -437,9 +437,9 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileSpecificContentType = passOn uri: "/multipart/form-data/file/specific-content-type", method: "post", request: { - headers: { - "content-type": "multipart/form-data", - }, + body: multipart({ + files: [{ fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }], + }), }, response: { status: 204, @@ -460,9 +460,9 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileRequiredFilename = passOnSuc uri: "/multipart/form-data/file/required-filename", method: "post", request: { - headers: { - "content-type": "multipart/form-data", - }, + body: multipart({ + files: [{ fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }], + }), }, response: { status: 204, @@ -483,9 +483,12 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileArray = passOnSuccess({ uri: "/multipart/form-data/file/file-array", method: "post", request: { - headers: { - "content-type": "multipart/form-data", - }, + body: multipart({ + files: [ + { fieldname: "files", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }, + { fieldname: "files", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }, + ], + }), }, response: { status: 204, diff --git a/packages/http-specs/specs/payload/pageable/mockapi.ts b/packages/http-specs/specs/payload/pageable/mockapi.ts index 3fdbf8c794e..c77b1328a1e 100644 --- a/packages/http-specs/specs/payload/pageable/mockapi.ts +++ b/packages/http-specs/specs/payload/pageable/mockapi.ts @@ -4,6 +4,7 @@ import { json, MockRequest, passOnSuccess, + ResolverConfig, ScenarioMockApi, ValidationError, xml, @@ -553,7 +554,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithContinuation = passOnSuccess([ status: 200, body: xml(XmlContTokenFirstPage), headers: { - "content-type": "application/xml", + "content-type": "application/xml; charset=utf-8", }, }, handler: (req: MockRequest) => { @@ -590,7 +591,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithContinuation = passOnSuccess([ status: 200, body: xml(XmlContTokenSecondPage), headers: { - "content-type": "application/xml", + "content-type": "application/xml; charset=utf-8", }, }, handler: (req: MockRequest) => { @@ -659,9 +660,15 @@ Scenarios.Payload_Pageable_XmlPagination_listWithNextLink = passOnSuccess([ request: {}, response: { status: 200, - body: xml(xmlNextLinkFirstPage("PLACEHOLDER_BASE_URL")), + body: { + contentType: "application/xml", + rawContent: { + serialize: (config: ResolverConfig) => + `` + xmlNextLinkFirstPage(config.baseUrl), + }, + }, headers: { - "content-type": "application/xml", + "content-type": "application/xml; charset=utf-8", }, }, handler: (req: MockRequest) => { @@ -683,7 +690,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithNextLink = passOnSuccess([ status: 200, body: xml(XmlNextLinkSecondPage), headers: { - "content-type": "application/xml", + "content-type": "application/xml; charset=utf-8", }, }, kind: "MockApiDefinition", diff --git a/packages/spector/src/actions/server-test.ts b/packages/spector/src/actions/server-test.ts index 6cd60ddbdf3..aeb1d8f2c3c 100644 --- a/packages/spector/src/actions/server-test.ts +++ b/packages/spector/src/actions/server-test.ts @@ -91,7 +91,7 @@ class ServerTestsGenerator { switch (body.contentType) { case "application/xml": case "text/plain": - if (body.rawContent !== responseData) { + if (raw !== responseData) { throw new ValidationError("Response data mismatch", raw, responseData); } break; From 0b564189b7ad8838a157e07437dd873a674bc9dd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 20:23:36 +0000 Subject: [PATCH 3/4] Add changelog and format code - Add chronus changeset for http-specs and spector fixes - Format mockapi.ts with prettier Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- .chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md | 8 ++++++++ packages/http-specs/specs/payload/multipart/mockapi.ts | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md diff --git a/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md b/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md new file mode 100644 index 00000000000..e889486d6f7 --- /dev/null +++ b/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@typespec/http-specs" + - "@typespec/spector" +--- + +Fix e2e test failures: duration header float scenarios, multipart file upload scenarios, XML pagination content-type mismatch, and response body data mismatch validation diff --git a/packages/http-specs/specs/payload/multipart/mockapi.ts b/packages/http-specs/specs/payload/multipart/mockapi.ts index 70a8b4a3500..ea54b460201 100644 --- a/packages/http-specs/specs/payload/multipart/mockapi.ts +++ b/packages/http-specs/specs/payload/multipart/mockapi.ts @@ -438,7 +438,9 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileSpecificContentType = passOn method: "post", request: { body: multipart({ - files: [{ fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }], + files: [ + { fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }, + ], }), }, response: { @@ -461,7 +463,9 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileRequiredFilename = passOnSuc method: "post", request: { body: multipart({ - files: [{ fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }], + files: [ + { fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" }, + ], }), }, response: { From fdbc5b8d07ab0936f837bb0a177feecf795af23a Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 9 Mar 2026 13:30:04 -0700 Subject: [PATCH 4/4] Apply suggestion from @timotheeguerin --- .chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md b/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md index e889486d6f7..d697c19650b 100644 --- a/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md +++ b/.chronus/changes/fix-http-specs-e2e-tests-2026-03-09.md @@ -1,5 +1,5 @@ --- -changeKind: fix +changeKind: internal packages: - "@typespec/http-specs" - "@typespec/spector"