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

Method add

httpie/cli/dicts.py:18–36  ·  view source on GitHub ↗

Add or update a new header. If the given `value` is `None`, then all the previous values will be overwritten and the value will be set to `None`.

(self, key, value)

Source from the content-addressed store, hash-verified

16 """
17
18 def add(self, key, value):
19 """
20 Add or update a new header.
21
22 If the given `value` is `None`, then all the previous
23 values will be overwritten and the value will be set
24 to `None`.
25 """
26 if value is None:
27 self[key] = value
28 return None
29
30 # If the previous value for the given header is `None`
31 # then discard it since we are explicitly giving a new
32 # value for it.
33 if key in self and self.getone(key) is None:
34 self.popone(key)
35
36 super().add(key, value)
37
38 def remove_item(self, key, value):
39 """

Calls

no outgoing calls