Skip to content

Commit

Permalink
Add download test without closure
Browse files Browse the repository at this point in the history
  • Loading branch information
samrocketman committed Oct 3, 2023
1 parent 6331f78 commit 1aa7682
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,14 @@ class SimpleRestServiceBinaryTest extends GroovyTestCase {
// get response message from Nexus
assert request_history*.response_code == [201]
}
@Test public void test_SimpleRestService_apiFetch_binary_download_without_closure() {
URL api_url = new URL('http://localhost:8081/repository/hosted-raw-repo/plain.txt')
def response = SimpleRestService.apiFetch(api_url, ['Binary-Data': true])
ByteArrayOutputStream plain = new ByteArrayOutputStream()

response.getInputStream().withCloseable { is ->
plain << is
}
assert plain.toString() == 'this is a simple file'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dGhpcyBpcyBhIHNpbXBsZSBmaWxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
null:
- HTTP/1.1 200 OK
Server:
- Nexus/3.60.0-02 (OSS)
X-Content-Type-Options:
- nosniff
Content-Disposition:
- attachment
Content-Security-Policy:
- sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts
allow-top-navigation
Last-Modified:
- Tue, 03 Oct 2023 05:23:08 GMT
Content-Length:
- '21'
X-XSS-Protection:
- 1; mode=block
Date:
- Tue, 03 Oct 2023 05:29:04 GMT
Content-Type:
- text/plain

0 comments on commit 1aa7682

Please sign in to comment.