Skip to content

Fix type mismatch (bytes & str) when OIDC token request fails

Yuto Takano requested to merge fix-oidc-token-error-type-mismatch into master

HttpResponse.content has a bytes type, and the content is encoded to bytes if a string is assigned to the field. Thus, trying to append further strings to the field will fail with a type mismatch.

We fix the issue by constructing the response in one single operation, and passing it to HttpResponse. Further, we use the HttpResponseServerError subclass, which implements HttpResponse but is more descriptive and saves us from having to assign status code 500 manually.

Merge request reports

Loading