django - Python REST API access custom header values -
i using django rest-framework posting or getting data client application. client application sending custom header along request. how can access custom header value in rest api.
custome-header-key: asdqweryhh #this custom header set client.
please help
thanks
you can use request.meta dictionary.
with exception of content_length , content_type, given above, http headers in request converted meta keys converting characters uppercase, replacing hyphens underscores , adding http_ prefix name. so, example, header called x-bender mapped meta key http_x_bender.
so header value in example do:
request.meta['http_custom_header_key']
Comments
Post a Comment