This fix means a behaviour change to GET calls. Instead of a JSON payload, instead a filter param has been added to the URL itself. GET payloads are very unexpected in API designs, even though supported. * Todo write tests (with postman?) * Turn isAdmin logic into common middleware ```bash curl "http://localhost:3002/v1/schedules?apiKey=...&userId=2" ``` ```bash curl "http://localhost:3002/v1/schedules?apiKey=..." \ -d '{"name":"Hello", "userId": 2}' \ -H 'Content-Type: application/json' ```
11 lines
251 B
TypeScript
11 lines
251 B
TypeScript
import { defaultHandler } from "@calcom/lib/server";
|
|
|
|
import { withMiddleware } from "@lib/helpers/withMiddleware";
|
|
|
|
export default withMiddleware("HTTP_GET_OR_POST")(
|
|
defaultHandler({
|
|
GET: import("./_get"),
|
|
POST: import("./_post"),
|
|
})
|
|
);
|