51
51
import static com .google .common .base .Preconditions .checkState ;
52
52
import static org .hamcrest .Matchers .*;
53
53
import static org .jboss .netty .handler .codec .http .HttpHeaders .Names .*;
54
+ import static org .jboss .netty .handler .codec .http .HttpHeaders .Values .*;
54
55
import static org .jboss .netty .handler .codec .http .HttpMethod .*;
55
56
import static org .jboss .netty .handler .codec .http .HttpResponseStatus .*;
56
57
import static org .jboss .netty .handler .codec .http .HttpVersion .HTTP_1_1 ;
@@ -146,7 +147,7 @@ public void shouldDeliverCompleteFileIfReceivesRequestForWholeFile()
146
147
assertThat (_response , hasHeader (CONTENT_DISPOSITION ,
147
148
"attachment;filename=file" ));
148
149
assertThat (_response , not (hasHeader (DIGEST )));
149
- assertThat (_response , not ( hasHeader (ACCEPT_RANGES ) ));
150
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
150
151
assertThat (_response , not (hasHeader (CONTENT_RANGE )));
151
152
152
153
assertThat (_additionalWrites , hasSize (1 ));
@@ -169,7 +170,7 @@ public void shouldDeliverCompleteFileWithChecksumIfReceivesRequestForWholeFileWi
169
170
assertThat (_response , hasHeader (CONTENT_DISPOSITION ,
170
171
"attachment;filename=file" ));
171
172
assertThat (_response , hasHeader (DIGEST , "adler32=03da0195" ));
172
- assertThat (_response , not ( hasHeader (ACCEPT_RANGES ) ));
173
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
173
174
assertThat (_response , not (hasHeader (CONTENT_RANGE )));
174
175
175
176
assertThat (_additionalWrites , hasSize (1 ));
@@ -192,7 +193,7 @@ public void shouldDeliverCompleteFileIfReceivesRequestForWholeFileWithQuestionMa
192
193
assertThat (_response , hasHeader (CONTENT_DISPOSITION ,
193
194
"attachment;filename=\" file?here\" " ));
194
195
assertThat (_response , not (hasHeader (DIGEST )));
195
- assertThat (_response , not ( hasHeader (ACCEPT_RANGES ) ));
196
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
196
197
assertThat (_response , not (hasHeader (CONTENT_RANGE )));
197
198
198
199
assertThat (_additionalWrites , hasSize (1 ));
@@ -216,7 +217,7 @@ public void shouldDeliverCompleteFileIfReceivesRequestForWholeFileWithBackslashQ
216
217
assertThat (_response , hasHeader (CONTENT_DISPOSITION ,
217
218
"attachment;filename=\" file\\ \\ \\ \" here\" " ));
218
219
assertThat (_response , not (hasHeader (DIGEST )));
219
- assertThat (_response , not ( hasHeader (ACCEPT_RANGES ) ));
220
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
220
221
assertThat (_response , not (hasHeader (CONTENT_RANGE )));
221
222
222
223
assertThat (_additionalWrites , hasSize (1 ));
@@ -245,7 +246,7 @@ public void shouldDeliverCompleteFileIfReceivesRequestForWholeFileWithNonAsciiNa
245
246
assertThat (_response , hasHeader (CONTENT_DISPOSITION ,
246
247
"attachment;filename*=UTF-8''%E1%9A%A0%E1%9B%87%E1%9A%BB" ));
247
248
assertThat (_response , not (hasHeader (DIGEST )));
248
- assertThat (_response , not ( hasHeader (ACCEPT_RANGES ) ));
249
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
249
250
assertThat (_response , not (hasHeader (CONTENT_RANGE )));
250
251
251
252
assertThat (_additionalWrites , hasSize (1 ));
@@ -380,12 +381,16 @@ public void shouldRejectConnectRequests()
380
381
}
381
382
382
383
@ Test
383
- public void shouldRejectHeadRequests ()
384
+ public void shouldAcceptHeadRequests () throws URISyntaxException
384
385
{
385
- whenClientMakes (a (HEAD ).forUri ("/path/to/file" ));
386
+ givenPoolHas (file ("/path/to/file" ).withSize (1024 ));
387
+ givenDoorHasOrganisedReadOf (file ("/path/to/file" ).with (SOME_UUID ));
388
+ whenClientMakes (a (HEAD )
389
+ .forUri ("/path/to/file?dcache-http-uuid=" + SOME_UUID ));
386
390
387
- assertThat (_response .getStatus (), is (NOT_IMPLEMENTED ));
391
+ assertThat (_response .getStatus (), is (OK ));
388
392
assertThat (_response , hasHeader (CONTENT_LENGTH ));
393
+ assertThat (_response , hasHeader (ACCEPT_RANGES , BYTES ));
389
394
}
390
395
391
396
@ Test
0 commit comments