Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
tkarrow
@tkarrow
I am using VS code and I have installed REST Client
Huachao Mao
@Huachao
@tkarrow when I tried to send the GET request to the site you posted, I met the 404 error
John Rinehart
@johnrichardrinehart
Is anyone experiencing slow requests?
The same request through curl vs VS Code takes milliseconds with curl vs ~3s with the GUI.
Huachao Mao
@Huachao
@johnrichardrinehart could you please provide your request?
John Rinehart
@johnrichardrinehart
@Huachao no problem.
But, there's a small update.
Your plugin seems to be making 3 consecutive requests.
When I copy-paste as cURL command and execute that in ZSH there is only 1 request.
So, it is not my (localhost) server which is the source of the 3 requests.
Your plugin (the client) seems to be the one responsible.
I'm just testing a REST API locally, so the URL is something like http://localhost:8080 and I'm GETting the root resource.
So, the HTTP/1.1 request is like:
John Rinehart
@johnrichardrinehart
GET / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.65.3
Accept: */*
John Rinehart
@johnrichardrinehart
@Huachao I've provided some updates. I've tried removing and re-installing your plugin.
I'm on v0.23.0 of your VS Code extension and my VS Code about information yields:
Version: 1.40.2
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:52:45.129Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0
John Rinehart
@johnrichardrinehart
@Huachao ping? I've been unable to resolve this, yet.
Huachao Mao
@Huachao
@johnrichardrinehart How did you find that 3 consecutive requests are made towards the server?
John Rinehart
@johnrichardrinehart
I had my handler print a statement. It was printed 3x for each click of the "Send Request" button.
Huachao Mao
@Huachao
@johnrichardrinehart it seems that the request sent from the extension received a Redirect response. I think we can compare the outgoing requests sent by extension and cURL. First, set the rest-client.followredirect to false do disable the automatically redirection behavior, and set the rest-client.previewOption to exchange so that you can inspect the outgoing request sent from my extension. Second, add the -v option in your cURL request, and you can find the outgoing request in shell.
@johnrichardrinehart After that, we can compare the differences, and indentify the root cause.
John Rinehart
@johnrichardrinehart
Hmmm, my REST API doesn't do any redirection. But, I'll follow these instructions and update you once I have these data. Thank you.
Hitesh Singh
@hituraj

Hello folks,

Today, I added the plugin rest client plugin in VS and created the http file to make the api calls, however I am getting below error
write EPROTO 1215459160:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:

Initial thoughts, its looks like firewall/proxy issue ..any buddy has any idea how to overcome from this problem? thanks in advance

KenZR
@ckken
will support typescript ?
Huachao Mao
@Huachao
@ckken what do you mean TypeScript
jaymie9019
@jaymie9019
anyone know can md5(post json data) then add the result to a http header named sign?
Huachao Mao
@Huachao
@jaymie9019 it's not supported
Jason Elston
@jasonelston
Hello, really like this extension for VScode. I have a query around cookie handling. It seems that subsequent requests for a different subdomain don't include the cookie? Maybe there's a setting I'm missing? for example: login at auth.domain.local -> receive domain.local cookie, post a request to api.domain.local -> cookie is not sent in request. Any assistance appreciated.
Huachao Mao
@Huachao
@jasonelston I think you can have following things to check. Firstly please make sure the setting rest-client.rememberCookiesForSubsequentRequests is set to true. Secondly, if not working still, try to rollback to version 0.22.2, if worked, it means it's a known issue and already fixed in the code and not published yet. If still not working, please feel fee to paste the content of file in path ~/.rest-client/cookie.json
Jason Elston
@jasonelston
Thanks @Huachao for getting back to me quickly. After a bit more investigation it looks like there may be some issue specifically with storing my cookie. Sorry I should have checked other sites too :). If I hit http://google.com I get the following cookie format:
Set-Cookie: 1P_JAR=2020-02-28-18; expires=Sun, 29-Mar-2020 18:36:20 GMT; path=/; domain=.google.com; Secure,NID=xxx; expires=Sat, 29-Aug-2020 18:36:20 GMT; path=/; domain=.google.com; HttpOnly and the cookie is stored in ~/.rest-client/cookie.json

If I collect a cookie from our site, I get the following format
Set-Cookie: myCookie.local=xxx; Path=/; Domain=domain.local; Expires=Sun, 29 Mar 2020 18:34:40 GMT; HttpOnly and this cookie is not stored in ~/.rest-client/cookie.json.

I've checked this across three different versions (0.23.1,0.22.2,0.21.3) setting rest-client.rememberCookiesForSubsequentRequests to true and false explicitly and the behaviour is the same.

Jason Elston
@jasonelston
Any thoughts? I'll play a bit with the variations in the cookie format to see what the problem might be.
Jason Elston
@jasonelston
Some further information, the cookies are stored and submitted for subsequent requests when using Postman.
Huachao Mao
@Huachao
@jasonelston what's your request url, especially the request host
Jason Elston
@jasonelston
@Huachao How do I check what the request host is set to inside vscode?
I can see in postman the Host header is set to auth.domain.local
Huachao Mao
@Huachao
@jasonelston could you please show me your request in the file
Jason Elston
@jasonelston

@Huachao
First request (from ~/.rest-client/history.json)

{
  "method": "POST",
  "url": "http://auth.domain.local:5555/v2/login",
  "headers": {
    "Content-Type": "application/json",
    "User-Agent": "vscode-restclient"
  },
  "body": "{\n  \"email\": \"redacted\",\n  \"password\": \"123456\"\n}",
  "startTime": 1582971415788
}

First response

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Set-Cookie: domainCookie.local=<redacted>; Path=/; Domain=domain.local; Expires=Mon, 30 Mar 2020 10:22:39 GMT; HttpOnly
Date: Sat, 29 Feb 2020 10:22:39 GMT
Content-Length: 295
Connection: close

{
  "user": {
    <redacted>
  }
}

Second request

{
  "method": "POST",
  "url": "http://api.domain.local:8000/v1/<redacted>",
  "headers": {
    "Content-Type": "application/json",
    "User-Agent": "vscode-restclient"
  },
  "body": "<redacted>",
  "startTime": 1582971426667
}

Second response

HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Sat, 29 Feb 2020 10:28:29 GMT
Content-Length: 36
Connection: close

please login to perform this action
Jason Elston
@jasonelston
For reference, I'm running rest-client version 0.23.1 now and have left the default of sending cookies enabled.
Huachao Mao
@Huachao
@jasonelston I have found the root cause that breaks the cookiejar stores your cookie, since your domain domain.local violates the Public Suffix Rule. Postman can work since it explicits sets the property to false, https://github.com/postmanlabs/postman-sandbox/blob/299ea4603f2db6f566ac186a0a5336f209a75976/lib/sandbox/cookie-jar.js#L174
Huachao Mao
@Huachao
@jasonelston I have fixed in commit Huachao/vscode-restclient@0264470
Jason Elston
@jasonelston
Fantastic, thanks @Huachao I'll install the branch and give it a go. Any ideas on when that will be included in a release?
Huachao Mao
@Huachao
@jasonelston you can try this in the latest version 0.23.2
Pavel Voronin
@pavel-voronin
Hi! I need help. Do you know how to send POST body with new lines? Like this:
# @name post_scenario
POST /{{version}}/users/1/scenario HTTP/1.1
Host: {{host}}
Content-Type: text/plain
Authorization: Bearer {{accessToken}}

make-booking-link:
  type: api
  call: makeBooking
  next: working-hours, not-working-hours

working-hours:
  type: in
  hours: working
  next: we-are-open
REST client forces me to remove empty lines (
Valentin Marin
@valentinmarinro
Hi @Huachao , it is possible to run javascript code, for example calling the CryptoJS library?
Huachao Mao
@Huachao
@valentinmarinro it's still impossible, and issue Huachao/vscode-restclient#521 is tracking this.
Valentin Marin
@valentinmarinro
@Huachao thank you, for answer, some estimation when / if it will be implemented, we would like to move from Postman to RESTClient
Huachao Mao
@Huachao
@pavel-voronin I have fixed this issue and will publish it in the next release