(self, file_name)
| 183 | |
| 184 | # Get mime by filename |
| 185 | def getContentType(self, file_name): |
| 186 | file_name = file_name.lower() |
| 187 | ext = file_name.rsplit(".", 1)[-1] |
| 188 | |
| 189 | if ext == "css": # Force correct css content type |
| 190 | content_type = "text/css" |
| 191 | elif ext == "js": # Force correct javascript content type |
| 192 | content_type = "text/javascript" |
| 193 | elif ext == "json": # Correct json header |
| 194 | content_type = "application/json" |
| 195 | elif ext in ("ttf", "woff", "otf", "woff2", "eot"): |
| 196 | content_type = "application/font" |
| 197 | else: |
| 198 | content_type = mimetypes.guess_type(file_name)[0] |
| 199 | |
| 200 | if not content_type: |
| 201 | content_type = "application/octet-stream" |
| 202 | |
| 203 | return content_type.lower() |
| 204 | |
| 205 | # Return: <dict> Posted variables |
| 206 | def getPosted(self): |
no outgoing calls
no test coverage detected