経由で発行された次の HTTP 要求がありますPUT
。
http://example.com/api/student?q=%7B%22filters%22:%5B%7B%22name%22:%22id%22,%22op%22:%22%3D%3D%22,%22val%22:1%7D%5D,%22disjunction%22:true%7D
クエリ文字列は次のようにデコードされます。
q:{"filters":[{"name":"id","op":"==","val":1}],"disjunction":true}
私のフラスコの落ち着きのないコードでは、次のオプションを使用してエンドポイントを作成します。
{
'model': Student,
'methods': ['GET', 'PUT', 'PATCH', 'POST', 'DELETE'],
'preprocessors': {
'POST': [pre_post_student],
'PATCH_MANY': [pre_patch_many_student]
},
'allow_patch_many': True
},
そして、プリプロセッサ関数を定義しました:
def pre_patch_many_student(search_params=None, data=None, **kw):
# Handle group management for the given students
print search_params
ただし、上記のリクエストに対して関数が呼び出されるとsearch_params
、空の辞書として表示されます。
なんで?