Skip to content

Commit 91b5390

Browse files
authored
Remove left-over api-utils method (#17595)
Noticed this method was left-over from previous query handling logic in `api-utils` while working on #17370 so this removes the extra code which should be safe since `api-utils` is an internal file that shouldn't be relied on externally.
1 parent f8aeaa4 commit 91b5390

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

packages/next/next-server/server/api-utils.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -162,34 +162,6 @@ function parseJson(str: string): object {
162162
}
163163
}
164164

165-
/**
166-
* Parsing query arguments from request `url` string
167-
* @param url of request
168-
* @returns Object with key name of query argument and its value
169-
*/
170-
export function getQueryParser({ url }: IncomingMessage) {
171-
return function parseQuery(): NextApiRequestQuery {
172-
const { URL } = require('url')
173-
// we provide a placeholder base url because we only want searchParams
174-
const params = new URL(url, 'https://n').searchParams
175-
176-
const query: { [key: string]: string | string[] } = {}
177-
for (const [key, value] of params) {
178-
if (query[key]) {
179-
if (Array.isArray(query[key])) {
180-
;(query[key] as string[]).push(value)
181-
} else {
182-
query[key] = [query[key], value]
183-
}
184-
} else {
185-
query[key] = value
186-
}
187-
}
188-
189-
return query
190-
}
191-
}
192-
193165
/**
194166
* Parse cookies from `req` header
195167
* @param req request object

0 commit comments

Comments
 (0)