Comments (1)
I've figured it out, carefully preparing examples typically leads to understanding problems and solving issue :)
The body needs to be an object or array or else body-parser gets unhappy due to this code in body-parser:
if (strict) {
var first = firstchar(body)
if (first !== '{' && first !== '[') {
debug('strict violation')
throw createStrictSyntaxError(body, first)
}
}
So either disable strict mode:
app.use(
bodyParser.json({
strict: false,
})
);
or make sure the body is an object, not just a string
from ts-rest.
Related Issues (20)
- Providing header in `extraHeaders` causes TS error of: `Type 'string' is not assignable to type 'undefined'.`
- content-type header is overwritten
- @ts-rest/nest attempting to call an object as a function HOT 2
- Using `z.void` fails to parse empty `req.body`
- Feature request: HEAD requests
- Having `void` responses causes response parsing to fail HOT 1
- ts-rest Middleware called after specific Route HOT 7
- Missing docs for `@ts-rest/serverless`
- Replace `c.noBody()` with `z.void()`/`c.type<void>` for empty request/response body HOT 1
- More detailed error context HOT 2
- Vue Query v5.x.x.x HOT 2
- Add support for multipart/form-data file array
- Export a Zod response schema that matches the request validation error responses HOT 2
- Support multiple content-type responses
- Express contract errors are associated with handlers rather than exact code places HOT 3
- Boolean query parameter always true HOT 3
- No QueryClient set, use QueryClientProvider to set one HOT 1
- Add support/docs for listenTerminalRoute (SSE) HOT 1
- One contract per route HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-rest.