Skip to content

Commit

Permalink
array subscript
Browse files Browse the repository at this point in the history
  • Loading branch information
woshimaliang committed Dec 11, 2019
1 parent 82d8d63 commit 620fb49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/URLEncodedForm/Data/URLEncodedFormSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ final class URLEncodedFormSerializer {

/// Serializes a `[URLEncodedFormData]` at a given key.
private func serialize(_ array: [URLEncodedFormData], forKey key: Data) throws -> Data {
var i:UInt8 = 0
let collection = try array.map { value -> Data in
let keyPath = key + [.leftSquareBracket, .rightSquareBracket]
let keyPath = key + [.leftSquareBracket, i+Character("0").asciiValue!, .rightSquareBracket]
i = i+1
return try serialize(value, forKey: keyPath)
}

Expand Down

0 comments on commit 620fb49

Please sign in to comment.