Skip to content

[HttpClient] HttpExceptionTrait Misinterprets error response #38118

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy