Page MenuHomeMusing Studio

No OneTemporary

diff --git a/writeas.go b/writeas.go
index fc8d028..7255067 100644
--- a/writeas.go
+++ b/writeas.go
@@ -1,48 +1,48 @@
package writeas
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"time"
)
const (
- apiURL = "http://i.write.as"
+ apiURL = "https://write.as/api"
)
type API struct {
BaseURL string
}
// defaultHTTPTimeout is the default http.Client timeout.
const defaultHTTPTimeout = 10 * time.Second
var httpClient = &http.Client{Timeout: defaultHTTPTimeout}
func GetAPI() *API {
return &API{apiURL}
}
func (a API) Call(method, path string) (int, string, error) {
if method != "GET" && method != "HEAD" {
return 0, "", errors.New(fmt.Sprintf("Method %s not currently supported by library (only HEAD and GET).\n", method))
}
r, _ := http.NewRequest(method, fmt.Sprintf("%s%s", a.BaseURL, path), nil)
r.Header.Add("User-Agent", "writeas-go v1")
resp, err := httpClient.Do(r)
if err != nil {
return 0, "", err
}
defer resp.Body.Close()
content, err := ioutil.ReadAll(resp.Body)
if err != nil {
return resp.StatusCode, "", err
}
return resp.StatusCode, string(content), nil
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, May 16, 11:28 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240086

Event Timeline