better-call 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.cjs +1 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -486,5 +486,26 @@ const createItem = createEndpoint("/item/:id", {
|
|
|
486
486
|
})
|
|
487
487
|
```
|
|
488
488
|
|
|
489
|
+
#### Configuration
|
|
490
|
+
|
|
491
|
+
You can configure the open api schema by passing the `openAPI` option to the router.
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
const router = createRouter({
|
|
495
|
+
createItem
|
|
496
|
+
}, {
|
|
497
|
+
openAPI: {
|
|
498
|
+
disabled: false, //default false
|
|
499
|
+
path: "/api/reference", //default /api/reference
|
|
500
|
+
scalar: {
|
|
501
|
+
title: "My API",
|
|
502
|
+
version: "1.0.0",
|
|
503
|
+
description: "My API Description",
|
|
504
|
+
theme: "dark" //default saturn
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
})
|
|
508
|
+
```
|
|
509
|
+
|
|
489
510
|
## License
|
|
490
511
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -151,10 +151,7 @@ function toResponse(data, init) {
|
|
|
151
151
|
return toResponse(data.body, {
|
|
152
152
|
status: data.statusCode,
|
|
153
153
|
statusText: data.status.toString(),
|
|
154
|
-
headers:
|
|
155
|
-
...data.headers instanceof Headers ? Object.fromEntries(data.headers.entries()) : data?.headers,
|
|
156
|
-
...init?.headers instanceof Headers ? Object.fromEntries(init.headers.entries()) : init?.headers
|
|
157
|
-
}
|
|
154
|
+
headers: init?.headers || data.headers
|
|
158
155
|
});
|
|
159
156
|
}
|
|
160
157
|
let body = data;
|