Merge branch 'hoppscotch:main' into codeday/jason
This commit is contained in:
@@ -339,7 +339,14 @@ const selectRequest = () => {
|
|||||||
confirmChange.value = false
|
confirmChange.value = false
|
||||||
setRestReq(props.request)
|
setRestReq(props.request)
|
||||||
} else if (!active.value) {
|
} else if (!active.value) {
|
||||||
confirmChange.value = true
|
// If the current request is the same as the request to be loaded in, there is no data loss
|
||||||
|
const currentReq = getRESTRequest()
|
||||||
|
|
||||||
|
if (isEqualHoppRESTRequest(currentReq, props.request)) {
|
||||||
|
setRestReq(props.request)
|
||||||
|
} else {
|
||||||
|
confirmChange.value = true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const currentReqWithNoChange = active.value.req
|
const currentReqWithNoChange = active.value.req
|
||||||
const currentFullReq = getRESTRequest()
|
const currentFullReq = getRESTRequest()
|
||||||
|
|||||||
@@ -809,6 +809,37 @@ const samples = [
|
|||||||
testScript: "",
|
testScript: "",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command: `curl https://example.com -d "alpha=beta&request_id=4"`,
|
||||||
|
response: makeRESTRequest({
|
||||||
|
method: "POST",
|
||||||
|
name: "Untitled request",
|
||||||
|
endpoint: "https://example.com/",
|
||||||
|
auth: {
|
||||||
|
authType: "none",
|
||||||
|
authActive: true,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
contentType: "application/x-www-form-urlencoded",
|
||||||
|
body: rawKeyValueEntriesToString([
|
||||||
|
{
|
||||||
|
active: true,
|
||||||
|
key: "alpha",
|
||||||
|
value: "beta",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
active: true,
|
||||||
|
key: "request_id",
|
||||||
|
value: "4",
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
params: [],
|
||||||
|
headers: [],
|
||||||
|
preRequestScript: "",
|
||||||
|
testScript: "",
|
||||||
|
}),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
describe("Parse curl command to Hopp REST Request", () => {
|
describe("Parse curl command to Hopp REST Request", () => {
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ export const parseCurlCommand = (curlCommand: string) => {
|
|||||||
hasBodyBeenParsed = true
|
hasBodyBeenParsed = true
|
||||||
} else if (
|
} else if (
|
||||||
rawContentType.includes("application/x-www-form-urlencoded") &&
|
rawContentType.includes("application/x-www-form-urlencoded") &&
|
||||||
!!pairs
|
!!pairs &&
|
||||||
|
Array.isArray(rawData)
|
||||||
) {
|
) {
|
||||||
body = pairs.map((p) => p.join(": ")).join("\n") || null
|
body = pairs.map((p) => p.join(": ")).join("\n") || null
|
||||||
contentType = "application/x-www-form-urlencoded"
|
contentType = "application/x-www-form-urlencoded"
|
||||||
|
|||||||
Reference in New Issue
Block a user