Parsing Http output #577
-
I can parse JSON responses using jq when I use the silent option with http. This works because it returns only the body of the response. However, when I disable the silent option, the output includes response code and headers, making it non-JSON and preventing me from parsing it with jq. Is there any way or support in dagu for parsing status code and the response headers along with the JSON body? Sample yaml file with silent true. `steps:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi, Thanks for the detailed example. Can you please clarify a bit about how you want to handle the status code? One idea is to have a standard JSON schema like the example below. How does that sound? {
"status_code": 200,
"body": {
"some_field": "some_value"
}
} |
Beta Was this translation helpful? Give feedback.
-
One potential issue is when the body itself is not in JSON format. In such cases, a possible solution could be to keep the entire body as text for non-JSON bodies. |
Beta Was this translation helpful? Give feedback.
Yes, it's possible. I have just filed an issue on this.