MCPcopy
hub / github.com/httpie/cli / make_default_headers

Function make_default_headers

httpie/client.py:263–278  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

261
262
263def make_default_headers(args: argparse.Namespace) -> HTTPHeadersDict:
264 default_headers = HTTPHeadersDict({
265 'User-Agent': DEFAULT_UA
266 })
267
268 auto_json = args.data and not args.form
269 if args.json or auto_json:
270 default_headers['Accept'] = JSON_ACCEPT
271 if args.json or (auto_json and args.data):
272 default_headers['Content-Type'] = JSON_CONTENT_TYPE
273
274 elif args.form and not args.files:
275 # If sending files, `requests` will set
276 # the `Content-Type` for us.
277 default_headers['Content-Type'] = FORM_CONTENT_TYPE
278 return default_headers
279
280
281def make_send_kwargs(args: argparse.Namespace) -> dict:

Callers 1

make_request_kwargsFunction · 0.85

Calls 1

HTTPHeadersDictClass · 0.85

Tested by

no test coverage detected