Skip to content

How i can return custom response status? #180

Description

@alvassin

How is it possible to return 201 status for example?

Activity

  1. dchaplinsky commented on Mar 12, 2019

    @dchaplinsky
    Owner

    Are you sure that the problem is with library? I think normal aiohttp way should work just fine.
    What you've tried already?

  2. alvassin commented on Mar 12, 2019

    @alvassin
    ContributorAuthor

    Normally, i return Response with some body, custom headers, custom status.

    With aiohttp-validate decorator i have to return directly only body. There is no way to define http status or headers.
    See: https://github.com/dchaplinsky/aiohttp_validate/blob/master/aiohttp_validate/__init__.py#L138

  3. dchaplinsky commented on Mar 12, 2019

    @dchaplinsky
    Owner

    Yes, you are right. Well, cannot say I have too much time on this project now.
    Happy to review PR as long as it'll keep backward compatibility.

  4. alvassin commented on Mar 12, 2019

    @alvassin
    ContributorAuthor

    Okay, asked just in case if you have workaround :)

  5. dchaplinsky commented on Jul 19, 2026

    @dchaplinsky
    Owner

    Implemented in v2.0 (#754): return a (data, status) tuple from the handler, e.g. return {"id": new_id}, 201. A ready web.json_response(...) / StreamResponse is also passed through untouched if you need full control.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions