fix: cURL header imports without trailing space (#4724)
This commit is contained in:
parent
6d21c8c9eb
commit
bb36d32359
2 changed files with 43 additions and 0 deletions
|
|
@ -958,6 +958,48 @@ data2: {"type":"test2","typeId":"123"}`,
|
|||
responses: {},
|
||||
}),
|
||||
},
|
||||
{
|
||||
command: `curl --request GET \
|
||||
--url https://echo.hoppscotch.io/ \
|
||||
--header 'Authorization:Basic YXNkZmdoOjEyMzQ=' \
|
||||
--header 'User-Agent:Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0'
|
||||
--header 'foo:bar'`,
|
||||
response: makeRESTRequest({
|
||||
method: "GET",
|
||||
name: "Untitled",
|
||||
endpoint: "https://echo.hoppscotch.io/",
|
||||
auth: {
|
||||
authType: "basic",
|
||||
authActive: true,
|
||||
username: "asdfgh",
|
||||
password: "1234",
|
||||
},
|
||||
body: {
|
||||
contentType: null,
|
||||
body: null,
|
||||
},
|
||||
params: [],
|
||||
headers: [
|
||||
{
|
||||
active: true,
|
||||
key: "User-Agent",
|
||||
value:
|
||||
"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0",
|
||||
description: "",
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
key: "foo",
|
||||
value: "bar",
|
||||
description: "",
|
||||
},
|
||||
],
|
||||
preRequestScript: "",
|
||||
testScript: "",
|
||||
requestVariables: [],
|
||||
responses: {},
|
||||
}),
|
||||
},
|
||||
]
|
||||
|
||||
describe("Parse curl command to Hopp REST Request", () => {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
import { tupleToRecord } from "~/helpers/functional/record"
|
||||
|
||||
const getHeaderPair = flow(
|
||||
S.replace(":", ": "),
|
||||
S.split(": "),
|
||||
// must have a key and a value
|
||||
O.fromPredicate((arr) => arr.length === 2),
|
||||
|
|
|
|||
Loading…
Reference in a new issue