Skip to content

Commit

Permalink
fix: remove trailing ? from the url when no params are present (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
amk-dev authored Apr 22, 2024
1 parent 6227ecd commit 1e46a1f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion manifest.common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Hoppscotch Browser Extension",
"version": "0.33",
"version": "0.34",
"description": "Provides more capabilities for Hoppscotch",
"icons": {
"16": "icons/icon-16x16.png",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hoppscotch-extension",
"version": "0.33.0",
"version": "0.34.0",
"description": "Provides more features to the Hoppscotch webapp (https://hoppscotch.io/)",
"scripts": {
"clean": "rimraf dist .parcel-cache",
Expand Down
2 changes: 1 addition & 1 deletion src/hookContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}

window.__POSTWOMAN_EXTENSION_HOOK__ = {
getVersion: () => ({ major: 0, minor: 33 }),
getVersion: () => ({ major: 0, minor: 34 }),

decodeB64ToArrayBuffer: (input, ab) => {
const keyStr =
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ async function fetchUsingAxiosConfig(

const params = axiosConfig.params

if (params) {
if (params && Object.keys(params).length > 0) {
try {
const searchParams = new URLSearchParams(axiosConfig.url.split("?")[1])
const url = new URL(axiosConfig.url)

Object.keys(params).forEach((key) => {
searchParams.append(key, params[key])
url.searchParams.append(key, params[key])
})

axiosConfig.url =
axiosConfig.url.split("?")[0] + `?${searchParams.toString()}`
axiosConfig.url = url.toString()
} catch (_) {}
}

Expand Down

0 comments on commit 1e46a1f

Please sign in to comment.