kodepandai / lunox-framework

The Lunox Framework (Deprecated)
MIT License
22 stars 2 forks source link

Cannot submit form input using Method PUT #15

Closed axmad386 closed 2 years ago

axmad386 commented 2 years ago

By default, http form request only support GET and POST method. In Laravel we can do something like method overide to support other method. See example below

<form method="POST">
<input type="hidden" name="_method" value="PUT" />
</form>

I think this express middleware can solve this problem. Just need little adjustment for lunox Http Kernel. https://www.npmjs.com/package/method-override See custom logic part

axmad386 commented 2 years ago

Not working as expected. See this issue for tracking https://github.com/lukeed/polka/issues/183

axmad386 commented 2 years ago

I think we need to override Polka.handler method. Overrides the method just before this line https://github.com/lukeed/polka/blob/2ce10df97921126ffcc43e23aa14af18f93f49e1/packages/polka/index.js#L73

axmad386 commented 2 years ago

feature added in this commit 9ad2664e60e24c84cf895da9122260beebcef9fc via query _method

For example this will override method from POST to PUT method.

<form action="/user/2/update?_method=PUT" method="POST">
....
</form>