Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit 6674e2a

Browse files
committed
noted link headers in various documents
1 parent 9d1d64b commit 6674e2a

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

Docs/QuickStart.playground/Contents.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ if let json = Just.post(
178178
}
179179

180180

181+
//: ## Link Headers
182+
//: Many HTTP APIs feature Link headers. They make APIs more self describing
183+
//: and discoverable.
184+
//:
185+
//: Github uses these for pagination in their API, for example:
186+
187+
let gh = Just.head("https://api.github.com/users/dduan/repos?page=1&per_page=5")
188+
gh.headers["link"] // <https://api.github.com/user/75067/repos?page=2&per_page=5>; rel="next", <https://api.github.com/user/75067/repos?page=9&per_page=5>; rel="last"
189+
190+
//: Just will automatically parse these link headers and make them easily consumable:
191+
192+
gh.links["next"] // ["rel": "next", "url":"https://api.github.com/user/75067/repos?page=2&per_page=5"]
193+
gh.links["last"] // ["rel": "last", "url":"https://api.github.com/user/75067/repos?page=9&per_page=5"]
194+
195+
//: (be aware of Github's rate limits when you play with these)
196+
181197
//: ## Cookies
182198
//:
183199
//: If you expect the server to return some cookie, you can find them this way:

Docs/QuickStart.playground/timeline.xctimeline

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33
version = "3.0">
44
<TimelineItems>
55
<LoggerValueHistoryTimelineItem
6-
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=0&amp;EndingColumnNumber=20&amp;EndingLineNumber=179&amp;StartingColumnNumber=9&amp;StartingLineNumber=179&amp;Timestamp=455693370.322447"
6+
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=0&amp;EndingColumnNumber=20&amp;EndingLineNumber=182&amp;StartingColumnNumber=9&amp;StartingLineNumber=182&amp;Timestamp=462872685.952829"
7+
selectedRepresentationIndex = "0"
8+
shouldTrackSuperviewWidth = "NO">
9+
</LoggerValueHistoryTimelineItem>
10+
<LoggerValueHistoryTimelineItem
11+
documentLocation = "#CharacterRangeLen=6&amp;CharacterRangeLoc=2853&amp;EndingColumnNumber=7&amp;EndingLineNumber=81&amp;StartingColumnNumber=1&amp;StartingLineNumber=81&amp;Timestamp=462872716.632806"
12+
selectedRepresentationIndex = "0"
13+
shouldTrackSuperviewWidth = "NO">
14+
</LoggerValueHistoryTimelineItem>
15+
<LoggerValueHistoryTimelineItem
16+
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=7062&amp;EndingColumnNumber=17&amp;EndingLineNumber=195&amp;StartingColumnNumber=1&amp;StartingLineNumber=194&amp;Timestamp=462873916.609416"
717
selectedRepresentationIndex = "0"
818
shouldTrackSuperviewWidth = "NO">
919
</LoggerValueHistoryTimelineItem>

Docs/QuickStart.zip

1.34 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Just lets you to the following effortlessly:
2525
- timeouts
2626
- synchrounous / asyncrounous requests
2727
- upload / download progress tracking for asynchronous requests
28+
link headers
2829
- friendly accessible results
2930

3031
# Use

0 commit comments

Comments
 (0)