Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste curl modal #6384

Merged
merged 11 commits into from
Aug 25, 2023
Merged

Paste curl modal #6384

merged 11 commits into from
Aug 25, 2023

Conversation

jackkav
Copy link
Contributor

@jackkav jackkav commented Aug 24, 2023

changelog(Fixes): Re-added a way to paste curl requests directly into URL bar.

fixes: #6338

  • cancel change to url bar when curl paste detected
  • continue to single line mutliline pastes when not curl requests
  • always create new request
  • add from curl button icon
  • add from curl to folder and accept parentId assignment

@jackkav jackkav marked this pull request as draft August 24, 2023 16:23
@jackkav jackkav marked this pull request as ready for review August 24, 2023 21:17
@jackkav jackkav requested a review from a team August 24, 2023 21:18
Copy link
Member

@filfreire filfreire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackkav there might be a small bug when pasting some curls they are incorrectly picked up as invalid, example:

curl --request POST \
  --url 'http://mockbin.org/bin/c24b72a2-1aed-48a3-be2d-b6122e855333?foo=bar&foo=baz' \
  --header 'accept: application/json' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --cookie 'foo=bar; bar=baz' \
  --data foo=bar \
  --data bar=baz

shows
imagem

on the bottom. But if I add a space somewhere on the curl text in the modal, it becomes valid

imagem

@jackkav
Copy link
Contributor Author

jackkav commented Aug 25, 2023

@filfreire that's correct the validation check should be happening on paste as well as change. Could you give it a try for me please?

@filfreire
Copy link
Member

@jackkav seems the problem is the isValid and the req start as null / empty when the modal is first drawn after it's open

@gatzjames gatzjames enabled auto-merge (squash) August 25, 2023 15:11
@gatzjames gatzjames merged commit 5407006 into Kong:develop Aug 25, 2023
7 checks passed

const handleImportQueryFromUrl = useCallback(() => {
useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackkav I am wondering if there was a reason for this?

jackkav added a commit to jackkav/insomnia that referenced this pull request Nov 24, 2023
* remove pad left on pinned

* refactor filter logic

* first pass

* always create new curl req

* use terminal icon

* fix from curl folder

* wire up request create

* fix paste curl in url bar

* fix types

* fix test

* fix for initial draw isvalid check

---------

Co-authored-by: Filipe Freire <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Re-add paste CURL on URL bar
4 participants