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

Pre Request vars in request not getting proper value when using bru cli #3060

Open
2 tasks done
yellow-straw-hat opened this issue Sep 10, 2024 · 1 comment
Open
2 tasks done

Comments

@yellow-straw-hat
Copy link

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

Bruno cli seems to not using the defined variable :

vars:pre-request {
  base64_encoded_file: aGVsbG8gd29ybGQ=
}

image
image

So when calling the variable in the request body, it will always be empty

This tag (vars:pre-request) does not exist in your documentation here : https://docs.usebruno.com/bru-lang/tag-reference

.bru file to reproduce the bug

Upload file:

meta {
  name: Upload Files
  type: http
  seq: 10
}

post {
  url: http://localhost:8080/v1/file
  body: json
  auth: none
}

body:json {
  [
    {
      "contents": "{{base64_encoded_file}}"
    }
  ]
}

vars:pre-request {
  base64_encoded_file: aGVsbG8gd29ybGQ=
}

assert {
  res.status: eq 201
}

tests {
  test("should return 201 http status code", function() {
    expect(res.getStatus()).to.equal(201);
  });
}

Running with:


docker run \
  --rm --volume .:/tests \
  --workdir /tests bruno-cli:latest run

Note that this request is working with Bruno Desktop App.

Screenshots/Live demo link

image

My service is returning a 500 because it accepted an empty contents


2024/09/10 16:37:55 Upload files has began.
2024/09/10 16:37:55 Error decoding the file contents: illegal base64 data at input byte 0
2024/09/10 16:37:55 Error: Failed to upload file: illegal base64 data at input byte 0
@yellow-straw-hat yellow-straw-hat added the bug Something isn't working label Sep 10, 2024
@njdarda
Copy link

njdarda commented Sep 11, 2024

Seems to be duplicate of #2871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants