MCPcopy Create free account
hub / github.com/denoland/std / specify

Function specify

http/_negotiation/encoding.ts:65–86  ·  view source on GitHub ↗
(
  encoding: string,
  spec: EncodingSpecificity,
  i = -1,
)

Source from the content-addressed store, hash-verified

63}
64
65function specify(
66 encoding: string,
67 spec: EncodingSpecificity,
68 i = -1,
69): Specificity | undefined {
70 if (!spec.encoding) {
71 return;
72 }
73 let s = 0;
74 if (spec.encoding.toLowerCase() === encoding.toLowerCase()) {
75 s = 1;
76 } else if (spec.encoding !== "*") {
77 return;
78 }
79
80 return {
81 i,
82 o: spec.i,
83 q: spec.q,
84 s,
85 };
86}
87
88function parseAcceptEncoding(accept: string): EncodingSpecificity[] {
89 const accepts = accept.split(",");

Callers 2

parseAcceptEncodingFunction · 0.70
getEncodingPriorityFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected