Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.16 KB

File metadata and controls

43 lines (28 loc) · 1.16 KB

Function: lib.dom.form.makeHeader

README -> API Index -> Modules Index -> lib.dom.form -> makeHeader

Source Module: src/lib/dom/form/index.js Source Location: src/lib/dom/form/submit.js:154

Signature

makeHeader(opts = {})

Summary

Build request headers for form submit workflows.

Parameters

  • opts.method: request method (default POST).
  • opts.headers: caller headers merged over defaults.
  • opts.contentType: explicit content type hint.
  • opts.body: optional body used for type inference.

Behavior

  • Always starts with Accept: application/json.
  • If contentType is missing and body exists:
    • FormData -> multipart/form-data
    • string -> application/x-www-form-urlencoded
    • other objects -> application/json
  • Adds Content-Type only when body exists, method is not GET, and body is not FormData.

Returns

Plain header object.

Related