這裏是我的代碼Django的tastypie返回401總是POST方法和行之有效的GET
class termTypeResource(ModelResource):
class Meta:
queryset = TermType.objects.all()
resource_name = 'gettermtypes'
allowed_methods = ['get','post']
每當我做捲曲的API像下面
curl --dump-header - -H "Content-Type: application/json" -X POST --data {"termtype":"LONG"}' --apiURL--
它返回(注:我不想爲api POST添加驗證或授權)
HTTP/1.0 401 UNAUTHORIZED
Date: Fri, 17 Oct 2014 12:05:49 GMT
Server: WSGIServer/0.1 Python/2.7.6
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
那麼你的授權頭在哪裏? – coldmind 2014-10-17 12:14:34
@coldmind我已經從API刪除授權,因爲我不需要,即使它然後返回401. – Mithu 2014-10-17 12:17:42