2016-02-05 17 views

回答

1

我不認爲該端口號被剝離創建網絡掛接。

POST https://api.github.com/repos/my-name/my-repo/hooks 

與身體:

{ 
    "name": "web", 
    "active": true, 
    "events": [ 
    "push", 
    "pull_request" 
    ], 
    "config": { 
    "url": "http://example.com:345/webhook", 
    "content_type": "json" 
    } 
} 

創建網絡掛接:

enter image description here

順便說一句,這個頁面在GitHub上呈現URL沒有端口號。

但如果你點擊 「編輯」 按鈕:提出

enter image description here

的端口號。

如果執行

GET https://api.github.com/repos/my-name/my-repo/hooks 



    { 
    "url": "https://api.github.com/repos/my-name/my-repo/hooks/7221574", 
    "test_url": "https://api.github.com/repos/my-name/my-repo/hooks/7221574/test", 
    "ping_url": "https://api.github.com/repos/my-name/my-repo/hooks/7221574/pings", 
    "id": 7221574, 
    "name": "web", 
    "active": true, 
    "events": [ 
     "push", 
    "pull_request" 
    ], 
    "config": { 
    "url": "http://example.com:345/webhook", 
    "content_type": "json" 
    }, 
    "last_response": { 
    "code": 504, 
    "status": "timeout", 
    "message": "Service Timeout", 
    }, 
    "updated_at": "2016-02-08T09:37:45Z", 
    "created_at": "2016-02-08T09:37:45Z" 
    } 
} 

確保你會得到相同的:

  1. 您張貼有效的URL
  2. 身體是有效的JSON
  3. 您有權創建網絡掛接
  4. 您可以使用簡單的客戶端(郵差,高級REST客戶端)創建它
  5. 您的GitHub客戶端庫不會刪除端口號
相關問題