MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / toDict

Method toDict

lib/utils/har.py:181–206  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

179 raw=raw)
180
181 def toDict(self):
182 content = {
183 "mimeType": self.headers.get("Content-Type"),
184 "text": self.content,
185 "size": len(self.content or "")
186 }
187
188 binary = set([b'\0', b'\1'])
189 if any(c in binary for c in self.content):
190 content["encoding"] = "base64"
191 content["text"] = getText(base64.b64encode(self.content))
192 else:
193 content["text"] = getText(content["text"])
194
195 return {
196 "httpVersion": self.httpVersion,
197 "status": self.status,
198 "statusText": self.statusText,
199 "headers": [dict(name=key.capitalize(), value=value) for key, value in self.headers.items() if key.lower() != "uri"],
200 "cookies": [],
201 "content": content,
202 "headersSize": -1,
203 "bodySize": -1,
204 "redirectURL": "",
205 "comment": getText(self.comment),
206 }
207
208class FakeSocket(object):
209 # Original source:

Callers

nothing calls this directly

Calls 4

getTextFunction · 0.90
capitalizeMethod · 0.80
itemsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected