Repository navigation
A fix for the exports. Upgrading is a version bump with no code changes. What gets logged, persisted and shown in the viewer is unchanged; only exported text is affected.
🐛 Running an exported curl corrupted base64 values
For a form-encoded request, the exported cURL command sent each field with --data, which doesn't URL-encode. Your app sends the form encoded, so the server receives base64's + intact. From the exported curl it decoded every + as a space instead. On a real request with two base64 photos, they arrived with 215 and 167 spaces and failed to decode.
Form fields now use --data-urlencode, so curl encodes them the way your app does:
curl -X POST \
'https://api.example.com/outlet' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
--data-urlencode 'request={"photo":"/9j/4AAQ…","name":"Menteng'\''s"}'📋 Base64 copied out of an export didn't decode
JSONSerialization writes / as \/ by default, so base64 inside JSON read \/9j\/4AAQ…. That's valid JSON, but copy the base64 out of an export and the backslashes make it invalid. JSON values are now exported with plain /. That's the same JSON value, so the server sees no difference, and the base64 copies out as-is. Values that aren't JSON are left alone, and so is an escaped backslash before a /. Copy Raw Log and the captured 3rd-party body text no longer add \/ either.
Also fixed
- Apostrophes were escaped as
\', which doesn't work inside single quotes and broke the command. They're now escaped as'\''. - Dictionary bodies with a JSON
Content-Typeare exported as JSON instead ofkey=valuepairs. - Captured raw bodies use
--data-binary, still verbatim.
🧪 Tests
9 new, 57 total, all passing. These are the first exporter tests. Also checked end to end: a curl built from a real 63 KB form request with two photos, run against a local server that decodes the form like a backend would, now delivers JSON identical to what the app sent and both photos as valid JPEGs.
Installation
.package(url: "https://github.com/henrydavl/ApiLogKit.git", from: "0.5.2")Full changelog: 0.5.1...0.5.2