Repository navigation
chore(server): rewrite resolveHTTPResponse with Fetch - #5684
Conversation
This reverts commit a9b03d7.
| ); | ||
|
|
||
| const response = await resolveHTTPResponse({ | ||
| const response = await resolveResponse({ |
There was a problem hiding this comment.
how do we reject unsupported media types?
There was a problem hiding this comment.
getContentTypeHandlerOrThrow()
| const getInputForIndex = (() => { | ||
| const contentTypeHandler = getContentTypeHandlerOrThrow(req); | ||
|
|
||
| if (isBatchCall && !contentTypeHandler.batching) { |
| // if `getRawInput` fails, we can't include the input in the error | ||
| input = undefined; | ||
| } | ||
| const input = inputGetter.getParsedInput(); |
| } | ||
|
|
||
| await controller.write(formatter.end()); | ||
| await controller.close(); |
There was a problem hiding this comment.
This stuff is way tidier
| Object { | ||
| "headers": Object { | ||
| "Content-Type": "application/json", | ||
| "content-type": "application/json", |
There was a problem hiding this comment.
lambda always reformats as 'Content-Type' in the wild, though not sure if that's a problem here?
| return handler; | ||
| } | ||
|
|
||
| if (!handler && req.method === 'GET') { |
There was a problem hiding this comment.
I removed this behaviour originally because I don't believe it protects against the CSRF attack that we wanted to defend against? Best to throw 405 in any situation that we don't support it?
There was a problem hiding this comment.
I don't really understand the mechanisms in play though, just read the original issue/PR and got the impression that form verb support is what matters, and forms do have a method="get" option
There was a problem hiding this comment.
I want to be able to open tRPC GET queries in my browser
* rewrite lambda * nuke * tweaks * tweak * cool * cool * fix * bump * buump
This reverts commit c1585b6.
* shift complexity * cool * cool * cool * prob * cool * cool * tweak * mkay * tweak * tweak * cool * cool * cool * cool * cool * cool * cool * shift more * cool * cool * cool * cool * request info * wip * cool * cool * Update packages/server/src/unstable-core-do-not-import/http/types.ts * fix * tweak
β¦-and-multi # Conflicts: # .github/workflows/release-tmp.yml # examples/.experimental/next-formdata/src/server/routers/room.ts # examples/minimal-content-types/client/src/SendMultipartFormDataButton.tsx # examples/minimal-content-types/server/index.ts # examples/minimal-content-types/server/tsconfig.json # packages/server/src/@trpc/server/http.ts # packages/server/src/@trpc/server/index.ts # packages/server/src/adapters/aws-lambda/index.ts # packages/server/src/adapters/aws-lambda/utils.ts # packages/server/src/adapters/express.ts # packages/server/src/adapters/fastify/fastifyRequestHandler.ts # packages/server/src/adapters/fetch/fetchRequestHandler.ts # packages/server/src/adapters/fetch/types.ts # packages/server/src/adapters/next.ts # packages/server/src/adapters/node-http/content-type/form-data/index.ts # packages/server/src/adapters/node-http/content-type/json/getPostBody.ts # packages/server/src/adapters/node-http/content-type/json/index.ts # packages/server/src/adapters/node-http/content-type/types.ts # packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts # packages/server/src/adapters/node-http/types.ts # packages/server/src/adapters/standalone.ts # packages/server/src/unstable-core-do-not-import/http/contentType.ts # packages/server/src/unstable-core-do-not-import/http/index.ts # packages/server/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts # packages/server/src/unstable-core-do-not-import/http/types.ts # packages/server/src/unstable-core-do-not-import/rootConfig.ts # packages/tests/server/adapters/express.test.tsx # packages/tests/server/adapters/fastify.test.ts # packages/tests/server/adapters/next.test.ts # packages/tests/server/adapters/standalone.test.ts # packages/tests/server/react/octetStreams.test.tsx # www/docs/migration/migrate-from-v10-to-v11.mdx
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Merges #5676 into #5665
Closes #5676
Closes #1853
π― Changes
Rewrites our resolve HTTP response function so it takes a
Responseand outputs aRequestEach adapter is responsible of converting their internal request-representation to a
Responseand handle aResponse-responseβ Checklist