Browse Source

files formatting

pull/97/head
Mohammed 6 years ago
parent
commit
eda9b28338
  1. 8
      fastapi/routing.py
  2. 1
      tests/test_additional_responses.py

8
fastapi/routing.py

@ -148,9 +148,11 @@ class APIRoute(routing.Route):
existed_codes.append(add_response.status_code)
response_models: List[Any] = [m for m in add_response.models]
schema_field = None
if add_response.content_type == "application/json" or lenient_issubclass(
content_type, JSONResponse
) and len(response_models):
if (
add_response.content_type == "application/json"
or lenient_issubclass(content_type, JSONResponse)
and len(response_models)
):
schema_field = Field(
name=f"Additional_response_{add_response.status_code}",
type_=Union[tuple(response_models)],

1
tests/test_additional_responses.py

@ -2,7 +2,6 @@ import pytest
from fastapi import FastAPI
from fastapi.openapi.models import AdditionalResponse
from pydantic import BaseModel
from pydantic.error_wrappers import ValidationError
from starlette.responses import JSONResponse
from starlette.testclient import TestClient

Loading…
Cancel
Save