File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Superluminal-RESTfulAPI-Tests Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,26 @@ RESTfulAPIClientTest >> testQueryDoNotStoreResponseInCache [
476
476
withMessageText: ' Cannot complete the request'
477
477
]
478
478
479
+ { #category : ' tests - QUERY' }
480
+ RESTfulAPIClientTest >> testQueryEntityMustBeString [
481
+
482
+ self configureHttpClientToRespondWith: ( ( self jsonOkResponseWith: #( 1 2 3 ) )
483
+ addCachingDirective: ' Max-Age=60' ;
484
+ yourself ).
485
+
486
+ self
487
+ should: [
488
+ apiClient
489
+ query: ( ZnEntity bytes:
490
+ ( ByteArray streamContents: [ :out | 32 timesRepeat: [ out nextPut: 255 atRandom ] ] ) )
491
+ at: self location
492
+ accepting: ' application/json;version=1.0.0' asMediaType
493
+ withSuccessfulResponseDo: [ :responseContents | self fail ]
494
+ ]
495
+ raise: HTTPClientError badRequest
496
+ withMessageText: ' Entity to cache can' ' t be binary'
497
+ ]
498
+
479
499
{ #category : ' tests - QUERY' }
480
500
RESTfulAPIClientTest >> testQueryIgnoreETagsWhenDoNotStoreCachingPolicyIsInPlace [
481
501
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ ExpiringCacheKeyBuilder >> build [
48
48
{ #category : ' configuring' }
49
49
ExpiringCacheKeyBuilder >> entity: entity [
50
50
51
+ ( entity hasContentType and : [ entity contentType isBinary ] ) ifTrue: [
52
+ HTTPClientError badRequest signal : ' Entity to cache can' ' t be binary' ].
53
+
51
54
entity contents ifNotEmpty: [ :contents | parameters at: #entity put: contents asString ]
52
55
]
53
56
You can’t perform that action at this time.
0 commit comments