Skip to content

Commit

Permalink
Merge branch 'canary' into remove-mkdirp
Browse files Browse the repository at this point in the history
  • Loading branch information
lfades committed Oct 5, 2020
2 parents 008514e + d32b195 commit 4229c25
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
4 changes: 4 additions & 0 deletions examples/with-storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": []
}
1 change: 0 additions & 1 deletion examples/with-storybook/components/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
export default function Home() {
return <div>Hello World</div>
}
28 changes: 0 additions & 28 deletions packages/next/next-server/server/api-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,34 +162,6 @@ function parseJson(str: string): object {
}
}

/**
* Parsing query arguments from request `url` string
* @param url of request
* @returns Object with key name of query argument and its value
*/
export function getQueryParser({ url }: IncomingMessage) {
return function parseQuery(): NextApiRequestQuery {
const { URL } = require('url')
// we provide a placeholder base url because we only want searchParams
const params = new URL(url, 'https://n').searchParams

const query: { [key: string]: string | string[] } = {}
for (const [key, value] of params) {
if (query[key]) {
if (Array.isArray(query[key])) {
;(query[key] as string[]).push(value)
} else {
query[key] = [query[key], value]
}
} else {
query[key] = value
}
}

return query
}
}

/**
* Parse cookies from `req` header
* @param req request object
Expand Down

0 comments on commit 4229c25

Please sign in to comment.