@@ -59,7 +59,7 @@ func runTransition(cmd *cobra.Command, args []string) error {
5959
6060 // Respect --dry-run: emit the request details without executing.
6161 if c .DryRun {
62- out , _ := json . Marshal (map [string ]string {
62+ out , _ := marshalNoEscape (map [string ]string {
6363 "method" : "POST" ,
6464 "url" : c .BaseURL + fmt .Sprintf ("/rest/api/3/issue/%s/transitions" , issueKey ),
6565 "note" : fmt .Sprintf ("would transition %s to %q (transition ID resolved at runtime)" , issueKey , toStatus ),
@@ -138,7 +138,7 @@ func runTransition(cmd *cobra.Command, args []string) error {
138138 return & errAlreadyWritten {code : exitCode }
139139 }
140140
141- out , _ := json . Marshal (map [string ]string {
141+ out , _ := marshalNoEscape (map [string ]string {
142142 "status" : "transitioned" ,
143143 "issue" : issueKey ,
144144 "transition" : matchedName ,
@@ -160,7 +160,7 @@ func runAssign(cmd *cobra.Command, args []string) error {
160160
161161 // Respect --dry-run: emit the request details without executing.
162162 if c .DryRun {
163- out , _ := json . Marshal (map [string ]string {
163+ out , _ := marshalNoEscape (map [string ]string {
164164 "method" : "PUT" ,
165165 "url" : c .BaseURL + fmt .Sprintf ("/rest/api/3/issue/%s/assignee" , issueKey ),
166166 "note" : fmt .Sprintf ("would assign %s to %q (account ID resolved at runtime)" , issueKey , to ),
@@ -208,7 +208,7 @@ func runAssign(cmd *cobra.Command, args []string) error {
208208 if exitCode != jrerrors .ExitOK {
209209 return & errAlreadyWritten {code : exitCode }
210210 }
211- out , _ := json . Marshal (map [string ]string {
211+ out , _ := marshalNoEscape (map [string ]string {
212212 "status" : "unassigned" ,
213213 "issue" : issueKey ,
214214 })
@@ -255,7 +255,7 @@ func runAssign(cmd *cobra.Command, args []string) error {
255255 return & errAlreadyWritten {code : exitCode }
256256 }
257257
258- out , _ := json . Marshal (map [string ]string {
258+ out , _ := marshalNoEscape (map [string ]string {
259259 "status" : "assigned" ,
260260 "issue" : issueKey ,
261261 "to" : to ,
@@ -310,7 +310,15 @@ func fetchJSONWithBody(c *client.Client, ctx context.Context, method, path strin
310310
311311 c .VerboseLog (map [string ]any {"type" : "response" , "status" : resp .StatusCode })
312312
313- respBody , _ := io .ReadAll (resp .Body )
313+ respBody , err := io .ReadAll (resp .Body )
314+ if err != nil {
315+ apiErr := & jrerrors.APIError {
316+ ErrorType : "connection_error" ,
317+ Message : "reading response body: " + err .Error (),
318+ }
319+ apiErr .WriteJSON (c .Stderr )
320+ return nil , jrerrors .ExitError
321+ }
314322 if resp .StatusCode >= 400 {
315323 apiErr := jrerrors .NewFromHTTP (resp .StatusCode , string (respBody ), method , path , resp )
316324 apiErr .WriteJSON (c .Stderr )
0 commit comments