Skip to content

Commit

Permalink
fix: use --location param for url when parsing curl (hoppscotch#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
amk-dev authored Jun 22, 2023
1 parent 878ec83 commit 2afc878
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/hoppscotch-common/src/components/http/Headers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ watch(workingHeaders, (headersList) => {
// Sync logic between headers and working/bulk headers
watch(
request.value.headers,
() => request.value.headers,
(newHeadersList) => {
// Sync should overwrite working headers
const filteredWorkingHeaders = pipe(
Expand Down
13 changes: 3 additions & 10 deletions packages/hoppscotch-common/src/components/http/RequestOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
<script setup lang="ts">
import { useI18n } from "@composables/i18n"
import { HoppRESTRequest } from "@hoppscotch/data"
import { computed, ref, watch } from "vue"
import { useVModel } from "@vueuse/core"
import { computed, ref } from "vue"
export type RequestOptionTabs =
| "params"
Expand All @@ -70,15 +71,7 @@ const emit = defineEmits<{
(e: "update:modelValue", value: HoppRESTRequest): void
}>()
const request = ref(props.modelValue)
watch(
() => request.value,
(newVal) => {
emit("update:modelValue", newVal)
},
{ deep: true }
)
const request = useVModel(props, "modelValue", emit)
const selectedRealtimeTab = ref<RequestOptionTabs>("params")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ const parseURL = (urlText: string | number) =>
* @returns URL object
*/
export function getURLObject(parsedArguments: parser.Arguments) {
const location = parsedArguments.location ?? undefined

return pipe(
// contains raw url strings
parsedArguments._.slice(1),
[...parsedArguments._.slice(1), location],
A.findFirstMap(parseURL),
// no url found
O.getOrElse(() => new URL(defaultRESTReq.endpoint))
Expand Down

0 comments on commit 2afc878

Please sign in to comment.