Skip to content

Response headers and body are empty when HTTP response has an error status #872

@marubinotto

Description

@marubinotto

In the current PDK runtime implementation, the http_status_as_error setting of ureq is left as the default value true. As a result, when the server returns a 4xx or 5xx status code, the return value of ureq::run is ureq::Error::StatusCode, and the response headers and body cannot be accessed.

https://github.com/extism/extism/blob/main/runtime/src/pdk.rs#L287

Is this the intended behavior? Many APIs return error details in the response body when an error status is returned, so not being able to access the body can be problematic in such cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions