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

Import and save body parameters #47

Closed
violabg opened this issue Apr 25, 2021 · 14 comments
Closed

Import and save body parameters #47

violabg opened this issue Apr 25, 2021 · 14 comments
Labels
bug Something isn't working

Comments

@violabg
Copy link

violabg commented Apr 25, 2021

Is your feature request related to a problem? Please describe.
I have imported a collection from postman, but the body parameters (formdata) were not imported, so I added manually, but every time I go back to the request they are gone, and have to type them again, this is not very practical.

Describe the solution you'd like
Be able to import body parameters from postman and be able to keep them between vscode restarts and close/reopen request

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

Hi @violabg what version of Thunder Client are you using, as it is fixed in v1.0.7 import postman body params.

The form tab should not be changed when you make a request, what ever tab is active in body, it will take data from it and ignore data from other tabs.

Can you re-rest again and let me know, if you can share a sample postman file without any sensitive info, i will also test it and find out the issue.

@rangav rangav added the bug Something isn't working label Apr 25, 2021
@violabg
Copy link
Author

violabg commented Apr 25, 2021

I'm using 1.0.7

this is my collection that I'm having problems with

{
  "client": "Thunder Client",
  "collectionName": "xxxxxxxx",
  "dateExported": "2021-04-25T10:10:23.102Z",
  "version": "1.0",
  "requests": [
    {
      "headers": [
        { "name": "Content-Type", "value": "application/x-www-form-urlencoded" }
      ],
      "colId": "d7dee309-e853-4f3f-9d53-a244a719acb8",
      "name": "oauth/token",
      "url": "{{baseUrl}}/oauth/token",
      "method": "POST",
      "modified": "2021-04-25T10:10:14.754Z",
      "created": "2021-04-25T10:07:05.471Z",
      "_id": "0544b444-ac5e-4b17-b29f-2b4b635bad46",
      "body": {
        "type": "formencoded",
        "raw": "",
        "form": [
          { "name": "grant_type", "value": "password" },
          {
            "name": "client_id",
            "value": "xxxxxxxxxxxxxxxxxxxxxx"
          },
          { "name": "client_secret", "value": "xxxxxx" },
          { "name": "username", "value": "norris" },
          { "name": "password", "value": "changeme" },
          { "name": "scope", "value": "app_user tenant_manager customer" }
        ]
      },
      "tests": [
        {
          "type": "set-env-var",
          "custom": "json.access_token",
          "action": "setto",
          "value": "{{token}}"
        }
      ]
    },
    {
      "headers": [],
      "colId": "d7dee309-e853-4f3f-9d53-a244a719acb8",
      "name": "{{baseUrl}}/api/v1/vrtimeline",
      "url": "{{baseUrl}}/api/v1/vrtimeline?_format=json&app_nid=625&start_date=1599820699654&end_date=1600165468583&type=stats",
      "method": "GET",
      "modified": "2021-04-25T10:08:59.681Z",
      "created": "2021-04-25T10:07:05.471Z",
      "_id": "ab488c77-01db-4dc0-8fdf-8b313d6699cd",
      "auth": { "type": "bearer", "bearer": "{{token}}" },
      "tests": []
    },
    {
      "headers": [],
      "colId": "d7dee309-e853-4f3f-9d53-a244a719acb8",
      "name": "{{baseUrl}}/api/v1/vrsession",
      "url": "{{baseUrl}}/api/v1/vrsession?_format=json&sessionid=1d16cb28-e6c0-4529-8493-70ea9856092d100211615547379152-0",
      "method": "GET",
      "modified": "2021-04-25T10:07:05.476Z",
      "created": "2021-04-25T10:07:05.476Z",
      "_id": "23208974-5c48-45df-8266-f8857adac2cd",
      "auth": { "type": "bearer", "bearer": "{{token}}" }
    }
  ]
}

no matter what every time I go to oath/token the body parameters are go, try to restart vscode.

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

thanks i will test and get back to you

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

Hi @violabg i have just executed the first request by changing url to https://httpbin.org/anything and then i closed the vs code and opened back. I can still see the body parameters

am i missing any step to reproduce the issue?

@violabg
Copy link
Author

violabg commented Apr 25, 2021

I think I got the problem, is my client_secret

e3iL@'2iSM

when I use it, send the request
then switch to another request
when I go back the body params are empty

maybe is the ' character?

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

if thats the only one parameter, then value could be the issue as i use regex for env variable replacement,
try using any other value see if works

@violabg
Copy link
Author

violabg commented Apr 25, 2021

yes, that's the problem, if I remove it or replace even with " it works.
is the single digits quote that causes the problem. Unfortunately I don't have control over the client_secrect so I can't change it.
I would be great is you could fix it.

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

Ok I will try to escape it.

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

Can you try adding a slash \ before single quote

@violabg
Copy link
Author

violabg commented Apr 25, 2021

Can you try adding a slash \ before single quote

I did and is not working the request return an error and when I switch request and go back the params are empty again

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

Ok I will fix it

@violabg
Copy link
Author

violabg commented Apr 25, 2021

Ok I will fix it

were you able to reproduce it?

@rangav
Copy link
Collaborator

rangav commented Apr 25, 2021

yes i can reproduce, when there single quote data is not loaded into form fields, when i remove quote data loaded properly,

@rangav
Copy link
Collaborator

rangav commented Apr 29, 2021

v1.1.0 is now published - details here #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants