Skip to content

Commit 8b6e730

Browse files
committed
make Location headers use correct URLs
1 parent b645023 commit 8b6e730

File tree

8 files changed

+35
-33
lines changed

8 files changed

+35
-33
lines changed

content/v3/git/blobs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ read more about the use of media types in the API [here](/v3/media/).
3535
### Response
3636

3737
<%= headers 201,
38-
:Location => "https://api.github.com/git/:owner/:repo/blob/:sha" %>
39-
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" %>
38+
:Location => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" %>
39+
<%= json :blob_after_create %>
4040

4141
## Custom media types
4242

content/v3/git/commits.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ title: Git Commits | GitHub API
2222

2323
### Parameters
2424

25-
Name | Type | Description
25+
Name | Type | Description
2626
-----|------|--------------
2727
`message`|`string` | **Required**. The commit message
2828
`tree`|`string` | **Required**. The SHA of the tree object this commit points to
@@ -41,7 +41,7 @@ in with the authenticated user's information and the current date.
4141

4242
Both the `author` and `commiter` parameters have the same keys:
4343

44-
Name | Type | Description
44+
Name | Type | Description
4545
-----|------|-------------
4646
`name`|`string` | The name of the author (or commiter) of the commit
4747
`email`|`string` | The email of the author (or commiter) of the commit
@@ -59,6 +59,5 @@ Name | Type | Description
5959
### Response
6060

6161
<%= headers 201,
62-
:Location => "https://api.github.com/git/:owner/:repo/commit/:sha" %>
62+
:Location => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd" %>
6363
<%= json :new_commit %>
64-

content/v3/git/refs.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,21 @@ For a full refs listing, you'll get something that looks like:
4646

4747
### Parameters
4848

49-
Name | Type | Description
49+
Name | Type | Description
5050
-----|------|--------------
5151
`ref`|`type`| The name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
5252
`sha`|`type`| The SHA1 value to set this reference to
5353

5454

5555
### Input
5656

57-
<%= json "ref"=>"refs/heads/master",\
58-
"sha"=>"827efc6d56897b048c772eb4087f854f46256132" %>
57+
<%= json "ref"=>"refs/heads/featureA",\
58+
"sha"=>"aa218f56b14c9653891f9e74264a383fa43fefbd" %>
5959

6060
### Response
6161

62-
<%= headers 201 %>
62+
<%= headers 201, \
63+
:Location => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA" %>
6364
<%= json :ref %>
6465

6566
## Update a Reference
@@ -68,7 +69,7 @@ Name | Type | Description
6869

6970
### Parameters
7071

71-
Name | Type | Description
72+
Name | Type | Description
7273
-----|------|--------------
7374
`sha`|`type`| The SHA1 value to set this reference to
7475
`force`|`boolean`| Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`
@@ -81,8 +82,7 @@ Name | Type | Description
8182

8283
### Response
8384

84-
<%= headers 200, \
85-
:Location => "https://api.github.com/git/:owner/:repo/commit/:sha" %>
85+
<%= headers 200 %>
8686
<%= json :ref %>
8787

8888
## Delete a Reference
@@ -100,4 +100,3 @@ Example: Deleting a tag:
100100
### Response
101101

102102
<%= headers 204 %>
103-

content/v3/git/tags.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ would be unnecessary.
3333

3434
### Parameters
3535

36-
Name | Type | Description
36+
Name | Type | Description
3737
-----|------|--------------
3838
`tag`|`string`| The tag
3939
`message`|`string`| The tag message
@@ -43,7 +43,7 @@ Name | Type | Description
4343

4444
The `tagger` hash contains the following keys:
4545

46-
Name | Type | Description
46+
Name | Type | Description
4747
-----|------|--------------
4848
`name`|`string`| The name of the author of the tag
4949
`email`|`string`| The email of the author of the tag
@@ -63,6 +63,5 @@ Name | Type | Description
6363
### Response
6464

6565
<%= headers 201,
66-
:Location => "https://api.github.com/repos/:owner/:repo/git/tags/:sha" %>
66+
:Location => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" %>
6767
<%= json :gittag %>
68-

content/v3/git/trees.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ a new tree out.
3636

3737
### Parameters
3838

39-
Name | Type | Description
39+
Name | Type | Description
4040
-----|------|--------------
4141
`tree`|`array` of `hash`es | **Required**. Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure
4242
`base_tree`| `string` | The SHA1 of the tree you want to update with new data. If you don't set this, the commit will be created on top of everything; however, it will only contain your change, the rest of your files will show up as deleted.
4343

4444
The `tree` parameter takes the following keys:
4545

46-
Name | Type | Description
46+
Name | Type | Description
4747
-----|------|--------------
4848
`path`|`string`| The file referenced in the tree
4949
`mode`|`string`| The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink
@@ -65,6 +65,5 @@ Name | Type | Description
6565
### Response
6666

6767
<%= headers 201,
68-
:Location => "https://api.github.com/repos/:owner/:repo/git/trees/:sha" %>
68+
:Location => "https://api.github.com/repos/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7" %>
6969
<%= json :tree_new %>
70-

content/v3/pulls.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Name | Description
3636

3737
### Parameters
3838

39-
Name | Type | Description
39+
Name | Type | Description
4040
-----|------|--------------
4141
`state`|`string` | Either `open` or `closed` to filter by state. Default: `open`
4242
`head`|`string` | Filter pulls by head user and branch name in the format of `user:ref-name`. Example: `github:new-script-format`.
@@ -102,7 +102,7 @@ would namespace `head` with a user like this: `username:branch`.
102102
You can also create a Pull Request from an existing Issue by passing an
103103
Issue number instead of `title` and `body`.
104104

105-
Name | Type | Description
105+
Name | Type | Description
106106
-----|------|--------------
107107
`issue`|`number` | **Required**. The issue number in this repository to turn into a Pull Request.
108108

@@ -125,7 +125,7 @@ Name | Type | Description
125125

126126
### Input
127127

128-
Name | Type | Description
128+
Name | Type | Description
129129
-----|------|--------------
130130
`title`|`string` | The title of the pull request.
131131
`body`|`string` | The contents of the pull request.
@@ -182,7 +182,7 @@ Note: The response includes a maximum of 250 commits. If you are working with a
182182

183183
### Input
184184

185-
Name | Type | Description
185+
Name | Type | Description
186186
-----|------|-------------
187187
`commit_message`|`string`| The message that will be used for the merge commit
188188

content/v3/pulls/comments.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ By default, Review Comments are ordered by ascending ID.
3333

3434
### Parameters
3535

36-
Name | Type | Description
36+
Name | Type | Description
3737
-----|------|--------------
3838
`sort`|`string` | Can be either `created` or `updated`. Default: `created`
3939
`direction`|`string` | Can be either `asc` or `desc`. Ignored without `sort` parameter.
@@ -60,7 +60,7 @@ Name | Type | Description
6060

6161
### Input
6262

63-
Name | Type | Description
63+
Name | Type | Description
6464
-----|------|--------------
6565
`body`|`string` | **Required**. The text of the comment
6666
`commit_id`|`string` | **Required**. The SHA of the commit to comment on.
@@ -82,7 +82,7 @@ Name | Type | Description
8282
Instead of passing `commit_id`, `path`, and `position` you can reply to
8383
an existing Pull Request Comment like this:
8484

85-
Name | Type | Description
85+
Name | Type | Description
8686
-----|------|--------------
8787
`body`|`string` | **Required**. The text of the comment
8888
`in_reply_to`|`number` | **Required**. The comment id to reply to.
@@ -99,7 +99,7 @@ Name | Type | Description
9999

100100
<%= headers 201,
101101
:Location =>
102-
"https://api.github.com/repos/:owner/:repo/pulls/comments/1" %>
102+
"https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" %>
103103
<%= json :pull_comment %>
104104

105105
## Edit a comment
@@ -108,7 +108,7 @@ Name | Type | Description
108108

109109
### Input
110110

111-
Name | Type | Description
111+
Name | Type | Description
112112
-----|------|--------------
113113
`body`|`string` | **Required**. The text of the comment
114114

lib/resources.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,8 @@ def text_html(response, status, head = {})
13531353
}
13541354

13551355
REF = {
1356-
"ref" => "refs/heads/sc/featureA",
1357-
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA",
1356+
"ref" => "refs/heads/featureA",
1357+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA",
13581358
"object" => {
13591359
"type" => "commit",
13601360
"sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd",
@@ -1578,10 +1578,16 @@ def text_html(response, status, head = {})
15781578
BLOB = {
15791579
:content => "Content of the blob",
15801580
:encoding => "utf-8",
1581+
:url => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
15811582
:sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
15821583
:size => 100
15831584
}
15841585

1586+
BLOB_AFTER_CREATE = {
1587+
:url => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
1588+
:sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
1589+
}
1590+
15851591
CONTENT_CRUD = {
15861592
"content" => {
15871593
"name" => "hello.txt",

0 commit comments

Comments
 (0)