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

Adds ability to force json or xml parsing during templating #1200

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

gislikonrad
Copy link
Contributor

When requesting HTTP endpoints not under your control, you could come across an endpoint that doesn't respond with the correct content-type header value. For example getting an xml body, but the header says it's text/plain. You could also get a json body and there is no content-type header.

With this PR, I add a way to force parsing as json or xml when templating.

For JSON it would be like this: {{previous_request_name.response.body.asJson.$.data.id}}
For XML it would be like this: {{previous_request_name.response.body.asXml.//data/@id}}

@JerryJian
Copy link

I need this feature, because my response header is text/html, but the content is json format. Looking forward to the merger this PR, thanks. @Huachao

@Huachao Huachao merged commit 2541f7e into Huachao:master Aug 27, 2024
@Huachao
Copy link
Owner

Huachao commented Aug 27, 2024

@gislikonrad @JerryJian merged, thanks

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

Successfully merging this pull request may close these issues.

3 participants