by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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
Mike Alesso
@mike-alesso
Is there currently a way to set a variable that can be shared between files? I know the shared environment file exists but for many use cases it is nice to be able to run a command in one file and set a variable for use in other files.
guidoPaglie
@guidoPaglie
@mike-alesso do you have any news about this ?
Kristjan Adojaan
@adojaan
Hi! Is it possible to send curl requests to non-standard port? I have to make curl request to https://address.com:3102/api/ but all I get is Parse Error: Expected HTTP/
It works well in my VSCODE without specifying port.
Huachao Mao
@Huachao
@adojaan can you show me your curl request that executed in my extension?
Kristjan Adojaan
@adojaan
Hi @Huachao . Non-working request is
https://test.excellent.ee:3102/api/1/CUVc
"Send request" link is displayed and when I click it Parse Error: Expected HTTP/ is displayed. It does not complain, when I remove port number from the request (but obviously does not work as there is no service and it times out after some time). Your extension works well with another. The sample request should actually return nothing (without authorization), but it does not work with authorization either. The error is the same when my Request is
https://test.excellent.ee:3102/api/1/CUVc
Authorization: Basic **:**
(username and password hidden)
When using command line curl specifying -u**:* it works well.
Kristjan Adojaan
@adojaan
image.png
The request in the middle works well. Even when I add standard port :80 to the address.
Huachao Mao
@Huachao
@adojaan nice catch, the root cause is that the response sent from the server is malformed which causes Node.js throws a Parser Error when parsing the response. And the underlying HTTP client library built on Node.js called got that we use, will raise the error .
Kristjan Adojaan
@adojaan
image.png
Thank you but... ummm... will you do something about it or I have to change my query? Or we can do nothing as the server is out of my hands? I know, that it works well with command line curl (when authorized). Without authorization it returns 401. The only thing I notice with authorized request that it does not have newline at the end.
I can, of course, try to pass the information to the owner of the API, if you describe what is malformed in the request.
Huachao Mao
@Huachao
@adojaan thanks for your quick response, could you please provide the verbose info from curl in both cases(w/o Authorization header)? Thanks in advance.
Huachao Mao
@Huachao
@adojaan it seems related to the request header "accept-encoding": "gzip, deflate", maybe server didn't handle well for gzip response
bboh
@bboh
Hi, I am wondering if there is an intended way to run request files outside of an editor (cli or programmatically)? my use case is running them in a CI pipeline
Huachao Mao
@Huachao
@bboh No, currently it's not supported
douhaolee
@douhaolee
Hi, I set "rest-client.logLevel": "verbose", but still not found any logs under output for REST -- anyone knows about it?
Andy
@AndyBullivent

Hi - I'm attempting to hit a port on localhost with a call in VS code. My app's code in full fat VS can hit it, my browser can hit it, but VS rest client seems to have trouble. Probably my own fault somewhere, but thought I'd check here. It simply says

Connection is being rejected. The service isn’t running on the server, or incorrect proxy settings in vscode, or a firewall is blocking requests. Details: RequestError: connect ECONNREFUSED 127.0.0.1:9200.

Also - when I do successfully make a call elsewhere - I can select part of the response body in the response pane, copy and paste, but only once! After that, even after restarts and re-installs of the rest client, it won't allow me to do it again. Thought it was me, but it's done it over 2 different machines now!