// Crappy workaround. RSC doesn't return the body of the http request which contains // the script source, so do the same lower level calls it does to get it. func getSource(loc *cm15.RightScriptLocator) (respBody []byte, err error) { var params rsapi.APIParams var p rsapi.APIParams APIVersion := "1.5" client, _ := Config.Account.Client15() uri, err := loc.ActionPath("RightScript", "show_source") if err != nil { return respBody, err } req, err := client.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p) if err != nil { return respBody, err } resp, err := client.PerformRequest(req) if err != nil { return respBody, err } defer resp.Body.Close() respBody, _ = ioutil.ReadAll(resp.Body) if resp.StatusCode < 200 || resp.StatusCode > 299 { return respBody, fmt.Errorf("invalid response %s: %s", resp.Status, string(respBody)) } return respBody, nil }