8000 [HttpClient] HttpExceptionTrait Misinterprets error response · Issue #38118 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content 8000
[HttpClient] HttpExceptionTrait Misinterprets error response #38118
Closed
@emarref

Description

@emarref

Symfony version(s) affected: 4.4.12

Description

I am using the HTTP client to query a third party API. I am making a call that results in a 400 Bad Request response, and the response looks like this:

{
	"type": "validation_error",
	"detail": {
		"invalid_field_name": ["Reasons this field is invalid"]
	}
}

However the HTTP Client sees the detail property and assumes the response is in RFC 7807 format, and attempts to concatenate the detail with other strings.

The detail property is an object which causes an Array to string conversion error, preventing the response from being returned to application code.

How to reproduce

Use HTTP Client to make a request that results in a 400 Bad Request response, and returns a json payload with a non-scalar title or detail property.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0