package configloader

import (
    "net/http"
)

// Returns the HTTP status code for a url while sending requests using
// a user-agent specific to the app.
func HttpGetStatusCode(url string) (int, error) {

    // create HTTP request
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        return 0, err
    }

    // set User-Agent header
    req.Header.Set("User-Agent", "museum-digital-uploader")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        return 0, err
    }
    defer resp.Body.Close()

    return resp.StatusCode, nil

}
