fatfree icon indicating copy to clipboard operation
fatfree copied to clipboard

POST,PUT,DELETE requests method keeps returning 405 method not found

Open peterson-umoke opened this issue 3 years ago • 3 comments

I have been screaming at my computer for hours now. Everything seems to be done right, but i can't get any other method apart from GET requests to work.

peterson-umoke avatar Mar 11 '22 12:03 peterson-umoke

Its keeps returning this error `

405 Method Not Allowed

Method Not Allowed

HTTP 405 (GET /contactz)

[vendor/bcosca/fatfree-core/base.php:1835] Base->error()
[index.php:16] Base->run()
`

peterson-umoke avatar Mar 11 '22 12:03 peterson-umoke

You need to add the verb to your route. If none is specified, then it defaults to just allowing GET.

$f3->route('GET|HEAD|POST|DELETE @sessions: /sessions', 'PJH\Page->sessions');

Or use map() if you're doing REST: https://fatfreeframework.com/3.7/routing-engine#ReST:RepresentationalStateTransfer

On Fri, 11 Mar 2022, 12:20 Peterson Umoke, @.***> wrote:

Its keeps returning this error `

405 Method Not Allowed Method Not Allowed

HTTP 405 (GET /contactz)

[vendor/bcosca/fatfree-core/base.php:1835] Base->error() [index.php:16] Base->run()

`

— Reply to this email directly, view it on GitHub https://github.com/bcosca/fatfree/issues/1249#issuecomment-1065063115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6B4LVRRORLR7NFZUI7ANDU7M27LANCNFSM5QPPBDEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

pauljherring avatar Mar 11 '22 13:03 pauljherring

Incidentally, this sort of question is better suited to the group, rather than raising an issue:

https://groups.google.com/g/f3-framework

pauljherring avatar Mar 11 '22 13:03 pauljherring