Skip to content

Commit 7c67ed1

Browse files
committed
Add documentation on testing hooks
1 parent de763c1 commit 7c67ed1

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

content/hooks/configuring/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ setup might look something like this:
5656
puts "I got some JSON: #{push.inspect}"
5757
end
5858

59-
6059
(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra guide].)
6160

6261
Start this server up.
@@ -79,7 +78,7 @@ were setting up a "real" web application, you might want to log some of the JSON
7978
output to a database.
8079

8180
For additional information on working with webhooks for fun and profit, head on
82-
over to the [Testing Webhooks][/hooks/testing] guide.
81+
over to the [Testing Webhooks](/hooks/testing) guide.
8382

8483
[platform samples]: https://github.com/github/platform-samples/tree/master/hooks/ruby/configuring-your-server
8584
[Sinatra]: http://www.sinatrarb.com/

content/hooks/testing/index.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ layout: hooks
55

66
# Testing Hooks
77

8-
(TODO: are we going to continue to recommend outside services, like RequestBin?)
9-
10-
### Configuring the Server
11-
12-
Now, the fun part. We'll set up a basic Sinatra server to handle incoming payloads:
13-
14-
```ruby
15-
require 'sinatra'
16-
require 'rest_client'
17-
require 'json'
18-
19-
post '/callback' do
20-
puts request.body.read
21-
end
22-
```
23-
24-
25-
```json
26-
{
27-
"payload":{
28-
"ref":"refs/heads/master",
29-
"after":"9a21d582f13c5b652c2c9546322bbf71682d3f06",
30-
"before":"05333fedb2f49ee2dd0dcc24b01d3d964f43c255",
31-
},
32-
...
33-
"event":"push",
34-
"config":{
35-
"greeting_message":"Hey, how it's going~!",
36-
"url":"http://4pw3.localtunnel.com/callback"
37-
},
38-
"guid":"6168aab4-4737-11e3-9ac9-7403c7a52ec3"
39-
}
40-
```
8+
* TOC
9+
{:toc}
10+
11+
Now that you've [configured your local server](/hooks/configuring/), you might
12+
be interested in pushing your code to the limits. To that end, GitHub's webhooks
13+
view provides some tooling for testing your deployed payloads.
14+
15+
16+
## Listing recent deliveries
17+
18+
Every webhook has its own "Recent Deliveries" section, which lists, at a glance
19+
whether a deployment was successful (green dot) or failed (red dot).
20+
21+
![Recent Deliveries view](/images/webhooks_recent_deliveries.png)
22+
23+
You can also identify when each delivery was attempted.
24+
25+
## Digging into results
26+
27+
By expanding an individual delivery, you'll be able to witness *precisely*
28+
what information GitHub is attempting to send to your server. This includes
29+
both the HTTP Request and Response.
30+
31+
### Request
32+
33+
The webhook delivery view provides information on which Headers were sent by GitHub.
34+
It also includes details about the JSON payload.
35+
36+
## Response
37+
38+
The response tab lists how your server replied once it received the payload from
39+
GitHub. This includes the status code, the headers, and any additional data
40+
within the response body.
67.1 KB
Loading

0 commit comments

Comments
 (0)