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

Capture response to file for a specific response #1326

Closed
jcamiel opened this issue Mar 3, 2023 Discussed in #1323 · 2 comments
Closed

Capture response to file for a specific response #1326

jcamiel opened this issue Mar 3, 2023 Discussed in #1323 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Mar 3, 2023

Discussed in #1323

Originally posted by tpluscode March 2, 2023
I have a resource like this:

{
  "id": "foobar",
  "images": {
    "small": "...url...",
    "medium": "...url...",
    "large": "...url..."
  }
}

It would be nice to "capture" entire responses as files within chained requests. I would capture the image URLs and follow the first request with 3 more to get the images

GET /resource

HTTP/* 200
[Captures]
id: jsonpath "$.id"
image-small: jsonpath "$.images.small"
image-medium: jsonpath "$.images.medium"
image-large: jsonpath "$.images.large"

GET {{image-small}}

HTTP/* 200
[Captures]
save-as: {{id}}/small.jpg

GET {{image-medium}}

HTTP/* 200
[Captures]
save-as: {{id}}/medium.jpg

GET {{image-large}}

HTTP/* 200
[Captures]
save-as: {{id}}/large.jpg
```</div>
@jcamiel jcamiel added the enhancement New feature or request label Mar 3, 2023
@jcamiel jcamiel added this to the 4.0.0 milestone Jun 9, 2023
@fabricereix fabricereix modified the milestones: 4.0.0, 4.1.0 Jun 28, 2023
@jcamiel jcamiel removed this from the 4.1.0 milestone Sep 9, 2023
@jcamiel jcamiel added this to the 4.2.0 milestone Sep 21, 2023
@jcamiel jcamiel linked a pull request Nov 30, 2023 that will close this issue
@jcamiel
Copy link
Collaborator Author

jcamiel commented Nov 30, 2023

Hi @tpluscode @RobertGauld @moono the --output per request option have landed on master:

GET https://foo.com
[Options]
output: /tmp/out.bin
HTTP 200

GET https://bar.com

If you know how to build a Rust program, I would be graceful to get feedback on the feature. In any case, the option will be available in the next Hurl release.

@jcamiel jcamiel closed this as completed Nov 30, 2023
@jcamiel
Copy link
Collaborator Author

jcamiel commented Dec 3, 2023

Fixes #2184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants