(self)
| 264 | |
| 265 | # Update HTTP headers based on the saved cookies and auth mechanism. |
| 266 | def refreshCustomHeaders(self): |
| 267 | self.__custom_headers = {} |
| 268 | |
| 269 | if self.__get_custom_headers_func: |
| 270 | cookie_header, has_auth_cookie = self.getHttpCookieHeaderForRequest() |
| 271 | self.__custom_headers = \ |
| 272 | self.__get_custom_headers_func(cookie_header, has_auth_cookie) |
| 273 | |
| 274 | for f in self.__add_custom_headers_funcs: |
| 275 | headers = f() |
| 276 | if headers is not None: |
| 277 | for key in headers: |
| 278 | assert key[0:2].lower() == "x-", \ |
| 279 | "header '{0}' is not valid, all custom headers must start with "\ |
| 280 | "'X-' or 'x-'".format(key) |
| 281 | assert key not in self.__custom_headers, \ |
| 282 | "header '{0}' already exists in custom headers dictionary".format(key) |
| 283 | self.__custom_headers[key] = headers[key] |
| 284 | |
| 285 | # Return first value as a cookie list for Cookie header. It's a list of name-value |
| 286 | # pairs in the form of <cookie-name>=<cookie-value>. Pairs in the list are separated by |
no test coverage detected