             }
 
             deferred.fill(Result(failure: RecordParseError()))
-        }))
-
+        })
+
+        req.responseParsedJSON(handler)
         return deferred
     }
 
-    private func putResource<T>(path: String, body: JSON, ifUnmodifiedSince: Timestamp?, f: (JSON) -> T?) -> Deferred<Result<StorageResponse<T>>> {
-        func requestPUT(url: NSURL) -> Request {
-            let req = NSMutableURLRequest(URL: url)
-            req.HTTPMethod = Method.PUT.rawValue
-            req.addValue("application/json", forHTTPHeaderField: "Accept")
-            let authorized: NSMutableURLRequest = self.authorizer(req)
-
-            if let ifUnmodifiedSince = ifUnmodifiedSince {
-                req.addValue(millisecondsToDecimalSeconds(ifUnmodifiedSince), forHTTPHeaderField: "X-If-Unmodified-Since")
+    // Sync storage responds with a plain timestamp to a PUT, not with a JSON body.
+    private func putResource<T>(path: String, body: JSON, ifUnmodifiedSince: Timestamp?, f: (String) -> T?) -> Deferred<Result<StorageResponse<T>>> {
+        let url = self.serverURI.URLByAppendingPathComponent(path)
+        return self.putResource(url, body: body, ifUnmodifiedSince: ifUnmodifiedSince, f: f)
+    }
+
+    private func putResource<T>(URL: NSURL, body: JSON, ifUnmodifiedSince: Timestamp?, f: (String) -> T?) -> Deferred<Result<StorageResponse<T>>> {
+
+        let deferred = Deferred<Result<StorageResponse<T>>>(defaultQueue: self.resultQueue)
+        let req = self.requestPUT(URL, body: body, ifUnmodifiedSince: ifUnmodifiedSince)
+        let handler = errorWrap(deferred, { (_, response, data, error) in
+            if let data = data as? String {
+                if let v = f(data) {
+                    let storageResponse = StorageResponse<T>(value: v, response: response!)
+                    deferred.fill(Result(success: storageResponse))
+                } else {
+                    deferred.fill(Result(failure: RecordParseError()))
+                }
+                return
             }
 
-            req.HTTPBody = body.toString().dataUsingEncoding(NSUTF8StringEncoding)!
-
-            return Alamofire.request(authorized)
-            .validate(contentType: ["application/json"])
-        }
-
-        return doOp(requestPUT, path: path, f: f)
+            deferred.fill(Result(failure: RecordParseError()))
+        })
+
+        // Yay Swift.
+        let stringHandler = { (a, b, c: String?, d) in
+            return handler(a, b, c, d)
+        }
+
+        req.responseString(encoding: nil, completionHandler: stringHandler)
+        return deferred
     }
 
     private func getResource<T>(path: String, f: (JSON) -> T?) -> Deferred<Result<StorageResponse<T>>> {

        return getResource("storage/meta/global", f: { GlobalEnvelope($0) })
    }

    func uploadMetaGlobal(metaGlobal: MetaGlobal, ifUnmodifiedSince: Timestamp?) -> Deferred<Result<StorageResponse<JSON>>> {
        let payload = metaGlobal.toPayload()
        if payload.isError {
            return Deferred(value: Result(failure: MalformedMetaGlobalError()))


private func errorWrap<T>(deferred: Deferred<Result<T>>, handler: ResponseHandler) -> ResponseHandler {
    return { (request, response, data, error) in
        log.debug("Response is \(response), data is \(data)")

        if let error = error {
            log.error("Got error \(error). Response: \(response?.statusCode)")
            deferred.fill(Result<T>(failure: RequestError(error)))
            return
        }

        if response == nil {
            // TODO: better error.
            log.error("No response")
            let result = Result<T>(failure: RecordParseError())
            deferred.fill(result)
            return
