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

[Bug]: Allow custom templating inside JSON Body #194

Open
1 task done
romain-pereira opened this issue Oct 24, 2024 · 2 comments
Open
1 task done

[Bug]: Allow custom templating inside JSON Body #194

romain-pereira opened this issue Oct 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@romain-pereira
Copy link

What happened?

I'm working with a data type that could contains templated Strings in JSON and I can't use the software to send a request to it.

Example body:
{ "name": {{CUSTOM_NAME}} }

Steps to reproduce?

1. Launch the application
2. Create a request
3. Add Body with JSON containing templating variables
4. Try send the request

What did you expect to happen?

It would be great to add an option to "Force Submit" a request even if the software detect that you don't defined a template placeholder because it's not related to HTTPie templating system itself.

Or another option to "escape" those variables.

Platform

macOS

HTTPie Desktop version

2022.5.1

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@romain-pereira romain-pereira added the bug Something isn't working label Oct 24, 2024
@dragoangel
Copy link

dragoangel commented Jan 10, 2025

{{CUSTOM_NAME}} definitely not a best choice for JSON 😉 templating, Go templating would be okay if you need template YAML or XML or anything else...

For JSON templating should avoid {{ or }} as on minimized (one-line) JSON you would get a mess 😊, better take something basic like $(var) or even $var and actual body would like { "name": "$name", "age": $age }

@romain-pereira
Copy link
Author

I absolutely agree with you but this is not a choice I made, sadly... I have to work on an existing software at work that is doing this and I'm now having to deal with it ... I'm actually working on a complete rework of this and i'll get rid of this stupid templating system. Thanks for your answer and i'll close this issue because you're true, templating a JSON using braces is a really bad idea !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants