Laravel中的POST请求仅允许内容类型json

时间:2020-05-07 15:55:29

标签: json laravel api

我正在构建laravel API,并且仅需要在发布数据时才能接受类型为“ application / json”的请求。任何其他内容类型都应返回406“不可接受”响应。

我知道我可以放入一些中间件进行检查,但是我想知道是否有更好的方法可以完成?

谢谢

2 个答案:

答案 0 :(得分:1)

像这样简单使用中间件:

create or replace procedure...
begin

select primary_keys from table..
-- save these keys to a temp cache or table

select primary_keys from table
-- save these additional keys to a temp cache or table

update table set field = 1 where primary_key in (select keys in temp cache or table)

commit;
delete temp cache or table

答案 1 :(得分:0)

这是我的两分钱

/mnt/backup
相关问题