Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Fp fix multipart request optional boudary #11

Open
wants to merge 2 commits into
base: swift3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Haitch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@
TargetAttributes = {
A3034B7F1BFD61F4003F8705 = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0810;
};
A3034B8F1BFD6229003F8705 = {
CreatedOnToolsVersion = 7.1.1;
};
CA8887F71D400317005A8390 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0810;
};
};
};
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/MultipartRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ open class MultipartRequestBody : RequestBody {

/// The boundary value of the MultipartRequestBody. Defaulted in the initializer to
/// "Boundary+\(arc4random())\(arc4random())"
open var boundary: String!
open var boundary: String = ""
/// The boundary carriage returns and line feed value. Defaults to "\r\n"
open var boundaryCRLF = "\r\n"

Expand All @@ -192,6 +192,7 @@ open class MultipartRequestBody : RequestBody {
public override init() {
super.init()
self.boundary = "Boundary+\(arc4random())\(arc4random())"
self.contentType = "multipart/form-data; boundary=\(self.boundary)"
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Source/Helpers/NetHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ open class NetHelper {
let parts: [HttpKeyPair] = params.allParams()
for keyPair: HttpKeyPair in parts {
let isMultiVal = params.isKeyMultiValue(key: keyPair.key)
let prefix = keyPair.escapedKeyPrefix ?? ""
let prefix = keyPair.escapedKeyPrefix
var suffix = ""
if isMultiVal {
suffix = keyPair.escapedKeySuffix ?? ""
suffix = keyPair.escapedKeySuffix
}
queryStringVal += "\(keyPair.toPartString(keyPrefix: prefix, keySuffix: suffix))&"
}
Expand Down