Ver a proveniência

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

tags/v1^0
Matt Baer há 5 anos
ascendente
cometimento
e897d3699f
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: 9C4CE3A27D62A6FB
1 ficheiros alterados com 8 adições e 1 eliminações
  1. +8
    -1
      writeas.go

+ 8
- 1
writeas.go Ver ficheiro

@@ -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)


Carregando…
Cancelar
Guardar