-
Notifications
You must be signed in to change notification settings - Fork 719
Make all members of HTTP{Request|Response}Head mutable. #324
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
Conversation
updates
merge master
Motivation:
Immutable members of structs (properties defined with let) can never be changed
even if the struct itself is mutable (defined withh var). This makes it difficult
to build rich convenience APIs on top of these structs.
Modifications:
Changed all 'let' stored properties on HTTP{Request|Response}Head to 'var'.
Result:
HTTP{Request|Response}Head are easier to use now.
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
Lukasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me.
|
@swift-nio-bot add to whitelist |
|
|
||
| // Internal representation of the URI. | ||
| private let rawURI: URI | ||
| private var rawURI: URI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is private so I think this makes no sense or I am missing something ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that one could stay let.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed adding a set case to uri, that is added now (and relies on rawURI being mutable)
weissi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks @tanner0101
Sources/NIOHTTP1/HTTPTypes.swift
Outdated
| /// The URI used on this request. | ||
| public var uri: String { | ||
| return String(uri: rawURI) | ||
| get { return String(uri: rawURI) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't usually skip the newlines here but I don't mind. CC @normanmaurer / @Lukasa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to add them just to make things consistent .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency is king
|
@swift-nio-bot test this please |
|
@tanner0101 thanks! |
Make all members of HTTP{Request|Response}Head mutable.
Motivation:
Immutable members of structs (properties defined with let) can never be changed
even if the struct itself is mutable (defined withh var). This makes it difficult
to build rich convenience APIs on top of these structs.
Modifications:
Changed all 'let' stored properties on HTTP{Request|Response}Head to 'var'.
Result:
HTTP{Request|Response}Head are easier to use now.