create-packer 1.26.0 → 1.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -21,8 +21,14 @@ function createServiceHooks() {
21
21
  async req => {
22
22
  // eslint-disable-next-line prefer-const
23
23
  let [url, searchParams] = req.url.split('?')
24
- const reqBody =
25
- !includes(['GET', 'HEAD'], req.method) && req.body ? await req.json() : void 0
24
+ let reqBody = void 0
25
+ if (!includes(['GET', 'HEAD'], req.method)) {
26
+ try {
27
+ reqBody = await req.json()
28
+ } catch {
29
+ /* empty */
30
+ }
31
+ }
26
32
  const parsedSearchParams = parse(searchParams)
27
33
  const reqConfig = {
28
34
  searchParams: parsedSearchParams,