PATCH and PUT Request Does not Working with form-data

后端 未结 7 1224
陌清茗
陌清茗 2020-12-16 10:12

I am using Laravel to create a RESTFUL application and I test the application with Postman. Currently, there is an issue for PATCH or PUT if the da

7条回答
  •  孤街浪徒
    2020-12-16 11:04

    As mentioned, this isn't a symfony (or laravel, or any other framework) issue, it's a limitation of PHP.

    After trawling through a good few RFCs for php core, the core development team seem somewhat resistant to implementing anything to do with modernising the handling of HTTP requests. The issue was first reported in 2011, it doesn't look any closer to having a native solution.

    That said, I managed to find this PECL extension. I'm not really very familiar with pecl, and couldn't seem to get it working using pear. but I'm using CentOS and Remi PHP which has a yum package.

    I ran yum install php-pecl-apfd and it literally fixed the issue straight away (well I had to restart my docker containers but that was a given).

    That is, request->all() and files->get() started working again with PATCH and PUT requests using multipart/form-data.

    I believe there are other packages in various flavours of linux and I'm sure anybody with more knowledge of pear/pecl/general php extensions could get it running on windows or mac with no issue.

提交回复
热议问题