MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / doPostRunRequest

Method doPostRunRequest

perfops/run.go:435–461  ·  view source on GitHub ↗
(ctx context.Context, path string, runReq *RunRequest)

Source from the content-addressed store, hash-verified

433}
434
435func (s *RunService) doPostRunRequest(ctx context.Context, path string, runReq *RunRequest) (TestID, error) {
436 if !isValidTarget(runReq.Target) {
437 return "", &argError{"target"}
438 }
439 if !isValidLimit(s.client.apiKey, runReq.Limit) {
440 return "", &argError{"limit"}
441 }
442
443 body, err := newJSONReader(runReq)
444 if err != nil {
445 return "", err
446 }
447 u := s.client.BasePath + path
448 req, _ := http.NewRequest("POST", u, body)
449 req = req.WithContext(ctx)
450 var raw struct {
451 Error string
452 ID string `json:"id"`
453 }
454 if err = s.client.do(req, &raw); err != nil {
455 return "", err
456 }
457 if raw.Error != "" {
458 return "", errors.New(raw.Error)
459 }
460 return TestID(raw.ID), nil
461}
462
463func (s *RunService) doGetRunOutput(ctx context.Context, path string, testID TestID) (*RunOutput, error) {
464 u := s.client.BasePath + path + string(testID)

Callers 5

LatencyMethod · 0.95
MTRMethod · 0.95
PingMethod · 0.95
TracerouteMethod · 0.95
TestDoPostRunRequestFunction · 0.80

Calls 5

isValidTargetFunction · 0.85
isValidLimitFunction · 0.85
newJSONReaderFunction · 0.85
TestIDTypeAlias · 0.85
doMethod · 0.80

Tested by 1

TestDoPostRunRequestFunction · 0.64