AnWeber / httpbook

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://httpyac.github.io/
MIT License
57 stars 4 forks source link

How can I make use of httpyac-plugin-jq in Notebook? #84

Closed holgerh closed 1 year ago

holgerh commented 1 year ago

I have the Plugin "httpyac-plugin-jq" installed in the repository. When I execute the request with the extension httpyac-vscode, the plugin is executed. When I execute the request with httpbook, the plugin is not executed.

How can I execute the notebook and get the result from the plugin?

AnWeber commented 1 year ago

I think I have an idea. VSCode uses Virtual Documents for the display of notebooks. These use an alternative filename, which does not match the real file Uri. Maybe a file URI conversion is missing.

AnWeber commented 1 year ago

Unfortunately, that was not the cause. It is rather that the httpac-plugin-jq only sets the body, but unfortunately does not reset the parsedBody. httpbook prefers to use the parsedBody and as a result this error occurs. In the output httpyac - Request you can see that even with httpBook execution, the response is correctly changed by jq.

image

One solution now would be to fix it in the jq plugin, but actually the API of httpyac is too complicated to use here. I should automatically correct the properties when a value is changed and set all other properties readonly.

AnWeber commented 1 year ago

Seems to be no easy fix. Workaround is to add some script block

# @name example
# @jq .slideshow.slides | map({title})
GET https://httpbin.org/json

{{+responseLogging
  delete response.parsedBody
}}
AnWeber commented 1 year ago

I have now solved it by means of a proxy that ensures that all bodies are always correctly deleted when the body is changed. fixed with release of vscode-httpyac