forked from vapor/vapor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Storage to Request + Response, deprecate userInfo (vapor#2216)
- Loading branch information
1 parent
56e0697
commit 41c9551
Showing
7 changed files
with
64 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
// nothing here yet... | ||
extension Application { | ||
private struct UserInfoKey: StorageKey { | ||
typealias Value = [AnyHashable: Any] | ||
} | ||
|
||
@available(*, deprecated, message: "Use storage instead.") | ||
public var userInfo: [AnyHashable: Any] { | ||
get { | ||
self.storage[UserInfoKey.self] ?? [:] | ||
} | ||
set { | ||
self.storage[UserInfoKey.self] = newValue | ||
} | ||
} | ||
} | ||
|
||
extension Request { | ||
private struct UserInfoKey: StorageKey { | ||
typealias Value = [AnyHashable: Any] | ||
} | ||
|
||
@available(*, deprecated, message: "Use storage instead.") | ||
public var userInfo: [AnyHashable: Any] { | ||
get { | ||
self.storage[UserInfoKey.self] ?? [:] | ||
} | ||
set { | ||
self.storage[UserInfoKey.self] = newValue | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters