Remove the given parameter completely from the Content-Type header. The header will be re-written in place without the parameter or its value. All values will be quoted as necessary unless requote is False. Optional header specifies an alternative to the Content-Type
(self, param, header='content-type', requote=True)
| 778 | self[header] = ctype |
| 779 | |
| 780 | def del_param(self, param, header='content-type', requote=True): |
| 781 | """Remove the given parameter completely from the Content-Type header. |
| 782 | |
| 783 | The header will be re-written in place without the parameter or its |
| 784 | value. All values will be quoted as necessary unless requote is |
| 785 | False. Optional header specifies an alternative to the Content-Type |
| 786 | header. |
| 787 | """ |
| 788 | if header not in self: |
| 789 | return |
| 790 | new_ctype = '' |
| 791 | for p, v in self.get_params(header=header, unquote=requote): |
| 792 | if p.lower() != param.lower(): |
| 793 | if not new_ctype: |
| 794 | new_ctype = _formatparam(p, v, requote) |
| 795 | else: |
| 796 | new_ctype = SEMISPACE.join([new_ctype, |
| 797 | _formatparam(p, v, requote)]) |
| 798 | if new_ctype != self.get(header): |
| 799 | del self[header] |
| 800 | self[header] = new_ctype |
| 801 | |
| 802 | def set_type(self, type, header='Content-Type', requote=True): |
| 803 | """Set the main type and subtype for the Content-Type header. |
no test coverage detected