@@ -471,10 +471,11 @@ func TestIssueService_PostAttachment(t *testing.T) {
471
471
if err != nil {
472
472
status = http .StatusNotAcceptable
473
473
}
474
+ defer file .Close ()
475
+
474
476
if file == nil {
475
477
status = http .StatusNoContent
476
478
} else {
477
-
478
479
// Read the file into memory
479
480
data , err := ioutil .ReadAll (file )
480
481
if err != nil {
@@ -483,11 +484,9 @@ func TestIssueService_PostAttachment(t *testing.T) {
483
484
if string (data ) != testAttachment {
484
485
status = http .StatusNotAcceptable
485
486
}
486
-
487
- w .WriteHeader (status )
488
- fmt .
Fprint (
w ,
`[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected] ","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/secure/attachment/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]` )
489
- file .Close ()
490
487
}
488
+ w .WriteHeader (status )
489
+ fmt .
Fprint (
w ,
`[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected] ","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/secure/attachment/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]` )
491
490
})
492
491
493
492
reader := strings .NewReader (testAttachment )
0 commit comments