Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties of HTTPResponses are now var #176

Merged
merged 1 commit into from
Oct 13, 2020
Merged
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
12 changes: 6 additions & 6 deletions Sources/AWSLambdaEvents/ALB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public enum ALB {
}

public struct TargetGroupResponse: Codable {
public let statusCode: HTTPResponseStatus
public let statusDescription: String?
public let headers: HTTPHeaders?
public let multiValueHeaders: HTTPMultiValueHeaders?
public let body: String
public let isBase64Encoded: Bool
public var statusCode: HTTPResponseStatus
public var statusDescription: String?
public var headers: HTTPHeaders?
public var multiValueHeaders: HTTPMultiValueHeaders?
public var body: String
public var isBase64Encoded: Bool

public init(
statusCode: HTTPResponseStatus,
Expand Down
13 changes: 5 additions & 8 deletions Sources/AWSLambdaEvents/APIGateway+V2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,21 @@ extension APIGateway.V2 {

extension APIGateway.V2 {
public struct Response: Codable {
public let statusCode: HTTPResponseStatus
public let headers: HTTPHeaders?
public let multiValueHeaders: HTTPMultiValueHeaders?
public let body: String?
public let isBase64Encoded: Bool?
public let cookies: [String]?
public var statusCode: HTTPResponseStatus
public var headers: HTTPHeaders?
public var body: String?
public var isBase64Encoded: Bool?
public var cookies: [String]?

public init(
statusCode: HTTPResponseStatus,
headers: HTTPHeaders? = nil,
multiValueHeaders: HTTPMultiValueHeaders? = nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed any longer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It never was supported in the first place. My mistake. Quote from docu:

To customize the response, your Lambda function should return a response with the following format.hv

{
   "cookies" : ["cookie1", "cookie2"],
   "isBase64Encoded": true|false,
   "statusCode": httpStatusCode,
   "headers": { "headerName": "headerValue", ... },
   "body": "Hello from Lambda!"
}     

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, need to point out in the release notes

body: String? = nil,
isBase64Encoded: Bool? = nil,
cookies: [String]? = nil
) {
self.statusCode = statusCode
self.headers = headers
self.multiValueHeaders = multiValueHeaders
self.body = body
self.isBase64Encoded = isBase64Encoded
self.cookies = cookies
Expand Down
10 changes: 5 additions & 5 deletions Sources/AWSLambdaEvents/APIGateway.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public enum APIGateway {

extension APIGateway {
public struct Response: Codable {
public let statusCode: HTTPResponseStatus
public let headers: HTTPHeaders?
public let multiValueHeaders: HTTPMultiValueHeaders?
public let body: String?
public let isBase64Encoded: Bool?
public var statusCode: HTTPResponseStatus
public var headers: HTTPHeaders?
public var multiValueHeaders: HTTPMultiValueHeaders?
public var body: String?
public var isBase64Encoded: Bool?

public init(
statusCode: HTTPResponseStatus,
Expand Down