소스 검색

Version 1, with basic API support around publishing, updating, and deleting posts.

tags/v1^0
Matt Baer 5 년 전
부모
커밋
e897d3699f
No known key found for this signature in database GPG 키 ID: 9C4CE3A27D62A6FB
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. +8
    -1
      writeas.go

+ 8
- 1
writeas.go 파일 보기

@@ -27,6 +27,9 @@ type Client struct {
token string
// Client making requests to the API
client *http.Client

// UserAgent overrides the default User-Agent header
UserAgent string
}

// defaultHTTPTimeout is the default http.Client timeout.
@@ -151,7 +154,11 @@ func (c *Client) doRequest(r *http.Request, result interface{}) (*impart.Envelop
}

func (c *Client) prepareRequest(r *http.Request) {
r.Header.Add("User-Agent", "go-writeas v1")
ua := c.UserAgent
if ua == "" {
ua = "go-writeas v1"
}
r.Header.Add("User-Agent", ua)
r.Header.Add("Content-Type", "application/json")
if c.token != "" {
r.Header.Add("Authorization", "Token "+c.token)


불러오는 중...
취소
저장