Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response format #1

Closed
kemingy opened this issue Dec 13, 2019 · 1 comment
Closed

response format #1

kemingy opened this issue Dec 13, 2019 · 1 comment
Labels
design Discuss about the design

Comments

@kemingy
Copy link
Member

kemingy commented Dec 13, 2019

According to API guidelines and GitHub API v3, the response format should be JSON, even for error responses.

So the response parameter may look like Response(HTTP_201, HTTP_409=Error_409).

@kemingy kemingy added the design Discuss about the design label Dec 13, 2019
@kemingy
Copy link
Member Author

kemingy commented Dec 19, 2019

Even though the interface is Response(*args, **kwargs), you cannot use

  • Response(200=RespModel) cause the key must obey Python naming rules
  • Response(HTTP_403) cause HTTP_403 is undefined

So the result is Response('HTTP_403', HTTP_200=RespModel). (Not very elegant)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Discuss about the design
Projects
None yet
Development

No branches or pull requests

1 participant