Skip to content

Commit

Permalink
Send API Keys
Browse files Browse the repository at this point in the history
  • Loading branch information
andreimarcu committed Oct 15, 2015
1 parent c13534f commit 9f89593
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions linx.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func upload(filePath string, deleteKey string, randomize bool, expiry int64) {
req.Header.Set("User-Agent", "linx-client")
req.Header.Set("Accept", "application/json")

if Config.apikey != "" {
req.Header.Set("Linx-Api-Key", Config.apikey)
}
if deleteKey != "" {
req.Header.Set("Linx-Delete-Key", deleteKey)
}
Expand Down Expand Up @@ -105,6 +108,10 @@ func upload(filePath string, deleteKey string, randomize bool, expiry int64) {

addKey(myResp.Url, myResp.Delete_Key)

} else if resp.StatusCode == 401 {

checkErr(errors.New("Incorrect API key"))

} else {
var myResp RespErrJSON

Expand All @@ -127,6 +134,10 @@ func deleteUrl(url string) {
req.Header.Set("User-Agent", "linx-client")
req.Header.Set("Linx-Delete-Key", deleteKey)

if Config.apikey != "" {
req.Header.Set("Linx-Api-Key", Config.apikey)
}

client := &http.Client{}
resp, err := client.Do(req)
checkErr(err)
Expand Down

0 comments on commit 9f89593

Please sign in to comment.