Remove ?main from fully-resolved URLs
This commit is contained in:
17
server/middleware/utils/createSearch.js
Normal file
17
server/middleware/utils/createSearch.js
Normal file
@ -0,0 +1,17 @@
|
||||
function createSearch(query) {
|
||||
const params = []
|
||||
|
||||
Object.keys(query).forEach(function (param) {
|
||||
if (query[param] === '') {
|
||||
params.push(param) // Omit the trailing "=" from param=
|
||||
} else {
|
||||
params.push(`${param}=${encodeURIComponent(query[param])}`)
|
||||
}
|
||||
})
|
||||
|
||||
const search = params.join('&')
|
||||
|
||||
return search ? `?${search}` : ''
|
||||
}
|
||||
|
||||
module.exports = createSearch
|
||||
Reference in New Issue
Block a user