Skip to content

Commit

Permalink
Update swagger2.py
Browse files Browse the repository at this point in the history
return no content if status==204
  • Loading branch information
julienschuermans authored Nov 28, 2024
1 parent 0f461aa commit 31154a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions connexion/operations/swagger2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import logging
import typing as t
from http import HTTPStatus

from connexion.datastructures import NoContent
from connexion.exceptions import InvalidSpecification
from connexion.operations.abstract import AbstractOperation
from connexion.uri_parsing import Swagger2URIParser
Expand Down Expand Up @@ -196,6 +198,10 @@ def example_response(self, status_code=None, *args, **kwargs):
status_code = int(status_code)
except ValueError:
status_code = 200

if status_code == HTTPStatus.NO_CONTENT:
return NoContent, status_code

try:
return (
list(deep_get(self._responses, examples_path).values())[0],
Expand Down

0 comments on commit 31154a9

Please sign in to comment.