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

Always getting: One or more HTTP methods are invalid #33

Open
0mars opened this issue Jul 6, 2021 · 2 comments
Open

Always getting: One or more HTTP methods are invalid #33

0mars opened this issue Jul 6, 2021 · 2 comments

Comments

@0mars
Copy link

0mars commented Jul 6, 2021

apispec.exceptions.APISpecError: One or more HTTP methods are invalid: connect, update, websocket, move, copy, checkout, propfind, trace, lock, report, uncheckin, version-control, proppatch, mkcol, checkin, unlock

code

class HealthCheck:
    def on_get(self, req, resp):
        """A cute furry animal endpoint.
        ---
        description: Get a random pet
        responses:
            200:
                description: A pet to be returned
                schema: PetSchema
        """
        resp.status = falcon.HTTP_200
        resp.body = json.dumps({"status": resp.status, "message": "healthy"})
@0mars
Copy link
Author

0mars commented Jul 12, 2021

Update 0.3.0 doesn't have the bug

@cyan5tar
Copy link

cyan5tar commented Nov 8, 2022

Just had to got through it as a newbi.
When running the server with gunicorn and the default falcon example i run into this error as well.
Im on version 0.4.0 and getting this error.

Code:

`
import falcon
from apispec import APISpec
from falcon_apispec import FalconPlugin
import json

class ThingsResource(object):
def on_get(self, req, resp):
"""Handles GET requests
---
description: Prints cite from Kant
responses:
200:
description: Cite to be returned
"""
resp.status = falcon.HTTP_200 # This is the default status
resp.body = ('\nTwo things awe me most, the starry sky '
'above me and the moral law within me.\n'
'\n'
' ~ Immanuel Kant\n\n')
resp.content_type = falcon.MEDIA_TEXT

app = application = falcon.API()

things = ThingsResource()
app.add_route("/things", things)

spec = APISpec(
title="Things APP",
version="0.0.1",
openapi_version='3.0',
plugins=[FalconPlugin(app)],
)

spec.path(resource=things)

print(json.dumps(spec.to_dict))
`

Thanks in advance

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

No branches or pull requests

2 participants