MCPcopy Create free account
hub / github.com/facebook/time / get

Method get

calnex/api/api.go:939–965  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

937 return r, nil
938}
939
940func (a *API) get(path string) error {
941 url := fmt.Sprintf(path, a.source)
942 resp, err := a.Client.Get(url)
943 if err != nil {
944 return err
945 }
946 defer resp.Body.Close()
947
948 if resp.StatusCode == http.StatusInternalServerError {
949 return ErrInternalError
950 }
951
952 if resp.StatusCode != http.StatusOK {
953 return errors.New(http.StatusText(resp.StatusCode))
954 }
955
956 r := &Result{}
957 if err = json.NewDecoder(resp.Body).Decode(r); err != nil {
958 return err
959 }
960
961 if !r.Result {
962 return errors.New(r.Message)
963 }
964
965 return nil
966}
967
968// StartMeasure starts measurement

Callers 5

StartMeasureMethod · 0.95
StopMeasureMethod · 0.95
ClearDeviceMethod · 0.95
RebootMethod · 0.95
TESTFunction · 0.45

Calls 2

CloseMethod · 0.65
GetMethod · 0.45

Tested by 1

TESTFunction · 0.36