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

base64 of file as a JSON input #2258

Open
glb-cblin opened this issue Dec 18, 2023 · 2 comments
Open

base64 of file as a JSON input #2258

glb-cblin opened this issue Dec 18, 2023 · 2 comments
Labels
enhancement New feature or request topic: generators

Comments

@glb-cblin
Copy link

Problem to solve

I'd like to upload the base64 of a file in one of the parameter of the body

# Upload picture
POST {{PUBLIC_URL}}/public-picture-api/my-pictures
Authorization: Bearer {{id_token}}
{
  "file": "//TODO",
  "fileType": "JPEG",
  "title": "{{title}}",
  "tags": ["{{tag}}"] 
}

At the moment, i must put the whole JSON body in a file ...

@glb-cblin glb-cblin added the enhancement New feature or request label Dec 18, 2023
@jcamiel
Copy link
Collaborator

jcamiel commented Dec 18, 2023

Hi @glb-cblin

Currently, there is no way to inject data in a Hurl file appart from variable.

Like with filter, we're going to introduced generators that will allow this usecase:

# Upload picture
POST {{PUBLIC_URL}}/public-picture-api/my-pictures
Authorization: Bearer {{id_token}}
{
  "file": {{ file "/tmp/foo.bin" base64Encode }},
  "fileType": "JPEG",
  "title": "{{title}}",
  "tags": ["{{tag}}"] 
}

(The syntax is still to be defined).
In this file file "foo.bin" is a generatord, followed by a filter base64dec

See also #2145

@glb-cblin
Copy link
Author

Hi @jcamiel

I've seen #2145 but I thought it was just for Asserts and Captures

Glad to know it will also be usable in bodies !

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

No branches or pull requests

2 participants