Skip to content

Commit

Permalink
update example apps
Browse files Browse the repository at this point in the history
Signed-off-by: Rafal Augustyniak <[email protected]>
  • Loading branch information
Augustyniak committed Jun 28, 2022
1 parent 62885af commit 702bc24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/objective-c/hello_world/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ - (void)performRequest {
NSString *message = [NSString stringWithFormat:@"received headers with status %i", statusCode];

NSMutableString *headerMessage = [NSMutableString new];
for (NSString *name in headers.allHeaders) {
for (NSString *name in headers.caseSensitiveHeaders()) {
if ([self.filteredHeaders containsObject:name]) {
NSArray<NSString *> *values = headers.allHeaders[name];
NSArray<NSString *> *values = headers.caseSensitiveHeaders()[name];
NSString *joined = [values componentsJoinedByString:@", "];
NSString *pair = [NSString stringWithFormat:@"%@: %@\n", name, joined];
[headerMessage appendString:pair];
Expand Down
2 changes: 1 addition & 1 deletion examples/swift/async_await/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private extension StreamClient {
return
}

let headerMessage = headers.caseSensitiveHeaders
let headerMessage = headers.caseSensitiveHeaders()
.map { "\($0.key): \($0.value.joined(separator: ", "))" }
.joined(separator: "\n")

Expand Down
11 changes: 8 additions & 3 deletions test/swift/apps/experimental/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ final class ViewController: UITableViewController {
let statusCode = headers.httpStatus.map(String.init) ?? "nil"
let message = "received headers with status \(statusCode)"

let headerMessage = headers.caseSensitiveHeaders()
.filter { kFilteredHeaders.contains($0.key) }
.map { "\($0.key): \($0.value.joined(separator: ", "))" }
let headerMessage = kFilteredHeaders
.compactMap { name in
guard let value = headers.value(forName: $0) else {
return nil
}

return "\($0.key): \($0.value.joined(separator: ", "))"
}
.joined(separator: "\n")

NSLog(message)
Expand Down

0 comments on commit 702bc24

Please sign in to comment.