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

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

Closed
holgerh opened this issue Apr 24, 2023 · 4 comments
Closed

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

holgerh opened this issue Apr 24, 2023 · 4 comments

Comments

@holgerh
Copy link

holgerh commented Apr 24, 2023

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
Copy link
Owner

AnWeber commented Apr 24, 2023

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
Copy link
Owner

AnWeber commented Apr 24, 2023

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
Copy link
Owner

AnWeber commented Apr 24, 2023

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
Copy link
Owner

AnWeber commented Apr 29, 2023

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

@AnWeber AnWeber closed this as completed Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants