@@ -52,31 +52,34 @@ func CheckForV3AvailabilityAndReturnProcessID(appID, baseURL, clientID, token st
5252 if resp .StatusCode == http .StatusNotFound {
5353 return appID , nil
5454 }
55- if resp .StatusCode == http .StatusOK {
56- processRequest , err := prepareRequest (baseURL , clientID , token , fmt .Sprintf ("/v3/apps/%s/processes/web" , appID ))
57- if err != nil {
58- return appID , sendSSHError ("failed preparing v3 request: %s" , err )
59- }
60- resp , err := apiClient .Do (processRequest )
61- if err != nil {
62- return appID , sendSSHError ("failed checking for processes of app_guid %s => '%s': %s" , processRequest .URL .Path , appID , err )
63- }
64- defer resp .Body .Close ()
65- respBytes , err := io .ReadAll (resp .Body )
66- if err != nil {
67- return appID , sendSSHError ("failed reading response for '%s': %s" , resp .Request .URL .Path , err )
68- }
69- appWebProcess := & cfresource.Process {}
70- err = appWebProcess .UnmarshalJSON (respBytes )
71- if err != nil {
72- return appID , sendSSHError ("failed unmarshaling response: '%s' for app_guid '%s': %s" , string (respBytes ), appID , err )
73- }
74- if appWebProcess .GUID == "" {
75- return appID , sendSSHError ("the processID returned was empty: %s" , string (respBytes ))
76- }
77- return appWebProcess .GUID , nil
55+
56+ if resp .StatusCode != http .StatusOK {
57+ return appID , err
7858 }
79- return appID , err
59+
60+ processRequest , err := prepareRequest (baseURL , clientID , token , fmt .Sprintf ("/v3/apps/%s/processes/web" , appID ))
61+ if err != nil {
62+ return appID , sendSSHError ("failed preparing v3 request: %s" , err )
63+ }
64+ resp , err = apiClient .Do (processRequest )
65+ if err != nil {
66+ return appID , sendSSHError ("failed checking for processes of app_guid %s => '%s': %s" , processRequest .URL .Path , appID , err )
67+ }
68+ defer resp .Body .Close ()
69+ respBytes , err := io .ReadAll (resp .Body )
70+ if err != nil {
71+ return appID , sendSSHError ("failed reading response for '%s': %s" , resp .Request .URL .Path , err )
72+ }
73+ appWebProcess := & cfresource.Process {}
74+ err = appWebProcess .UnmarshalJSON (respBytes )
75+ if err != nil {
76+ return appID , sendSSHError ("failed unmarshaling response: '%s' for app_guid '%s': %s" , string (respBytes ), appID , err )
77+ }
78+ if appWebProcess .GUID == "" {
79+ return appID , sendSSHError ("the processID returned was empty: %s" , string (respBytes ))
80+ }
81+ return appWebProcess .GUID , nil
82+
8083}
8184func (cfAppSsh * CFAppSSH ) appSSH (c echo.Context ) error {
8285 // Need to get info for the endpoint
0 commit comments