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

[propose] Named access to HTTP response #10

Open
ccidral opened this issue May 4, 2020 · 1 comment
Open

[propose] Named access to HTTP response #10

ccidral opened this issue May 4, 2020 · 1 comment
Labels
Follow Youtrack Issue For updates, follow mentioned in comment issue on https://youtrack.jetbrains.com

Comments

@ccidral
Copy link

ccidral commented May 4, 2020

Request

Ability to refer to HTTP response data by name.

Implementation

A fellow named Huachao Mao wrote an amazing HTTP client for VSCode from which we can get some inspiration: https://github.com/Huachao/vscode-restclient

His HTTP client allows binding a variable name to an HTTP request, so that the HTTP response becomes accessible via that name. It uses the syntax @name variable_name in a comment in the scope of the HTTP request.

Example:

###
# @name bananas
GET http://localhost/greeting

###
POST http://localhost/something/{{bananas.response.body.foo}}

{
  "message": "{{bananas.response.body.greeting}}"
}

The example above assumes that:

  1. GET http://localhost/greeting returns { "foo": 123, "greeting": "hello" }
  2. The content type is application/json so that the response is automatically parsed as JSON

The rest is self-explanatory.

Once the response is received, it binds the response object to the bananas variable name.

@zinoviy23
Copy link
Member

Thanks for request! For now you can solve this task using response handlers scripts. But maybe there is should be more easier and obvious way. I created issue: https://youtrack.jetbrains.com/issue/IDEA-240301

@zinoviy23 zinoviy23 added the Follow Youtrack Issue For updates, follow mentioned in comment issue on https://youtrack.jetbrains.com label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Follow Youtrack Issue For updates, follow mentioned in comment issue on https://youtrack.jetbrains.com
Projects
None yet
Development

No branches or pull requests

2 participants