MCPcopy Create free account
hub / github.com/brianleroux/tiny-json-http / is

Function is

_write.js:56–63  ·  view source on GitHub ↗
(headers, type)

Source from the content-addressed store, hash-verified

54 var postData = qs.stringify(options.data || {})
55
56 function is(headers, type) {
57 var regex = type instanceof RegExp
58 var upper = headers['Content-Type']
59 var lower = headers['content-type']
60 var isU = upper && (regex ? upper.match(type) : upper.startsWith(type))
61 var isL = lower && (regex ? lower.match(type) : lower.startsWith(type))
62 return isU || isL
63 }
64
65 // if we're posting JSON stringify options.data
66 var isJSON = is(opts.headers, /^application\/.*json/)

Callers 1

_write.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected