This repository was archived by the owner on Sep 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22{
33 using System ;
44 using System . Net ;
5+ using System . Net . Http . Headers ;
56 using System . Threading . Tasks ;
67 using Shouldly ;
78 using Xunit ;
@@ -20,12 +21,12 @@ public StreamMessageTests()
2021 [ Fact ]
2122 public async Task read_single_message_stream ( )
2223 {
23- // position of event in all stream would be helpful here
2424 var writeResult = await _fixture . WriteNMessages ( "a-stream" , 1 ) ;
2525
2626 using ( var response = await _fixture . HttpClient . GetAsync ( "/streams/a-stream/0" ) )
2727 {
2828 response . StatusCode . ShouldBe ( HttpStatusCode . OK ) ;
29+ response . Headers . ETag . ShouldBe ( new EntityTagHeaderValue ( $@ """{ writeResult . CurrentVersion } ;{ writeResult . CurrentPosition } """));
2930
3031 var resource = await response.AsHal();
3132
@@ -56,6 +57,7 @@ public async Task read_single_message_does_not_exist_stream()
5657 using ( var response = await _fixture . HttpClient . GetAsync ( "/streams/a-stream/0" ) )
5758 {
5859 response . StatusCode . ShouldBe ( HttpStatusCode . NotFound ) ;
60+ response. Headers . ETag . ShouldBeNull ( ) ;
5961
6062 var resource = await response. AsHal ( ) ;
6163
@@ -91,6 +93,7 @@ public async Task delete_single_message_by_version()
9193 using ( var response = await _fixture . HttpClient . GetAsync ( "/streams/a-stream/0" ) )
9294 {
9395 response . StatusCode . ShouldBe ( HttpStatusCode . NotFound ) ;
96+ response . Headers . ETag . ShouldBeNull ( ) ;
9497 }
9598 }
9699 }
Original file line number Diff line number Diff line change 11namespace SqlStreamStore . HAL
22{
3- using System ;
43 using System . Collections ;
54 using System . Collections . Generic ;
65 using Microsoft . AspNetCore . Http ;
7- using Microsoft . AspNetCore . Http . Features ;
86 using Microsoft . Extensions . Primitives ;
97
10- internal class CaseSensitiveQueryFeature : IQueryFeature
11- {
12- private readonly IFeatureCollection _features ;
13-
14- public CaseSensitiveQueryFeature ( IFeatureCollection features )
15- {
16- if ( features == null )
17- throw new ArgumentNullException ( nameof ( features ) ) ;
18- _features = features ;
19- }
20-
21- public IQueryCollection Query
22- {
23- get ;
24- set ;
25- }
26- }
27-
288 internal class CaseSensitiveQueryCollection : IQueryCollection
299 {
3010 private readonly QueryString _queryString ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ public static class Headers
88 public const string HeadPosition = "SSS-HeadPosition" ;
99 public const string MessageId = "SSS-MessageId" ;
1010 public const string Location = "Location" ;
11+ public const string ETag = "ETag" ;
1112
1213 public static class ContentTypes
1314 {
Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ public async Task<Response> Get(
7979 . AddLinks ( Links . Self ( operation ) )
8080 . AddLinks ( Links . Navigation ( operation , message ) )
8181 . AddLinks ( Links . Message ( operation ) )
82- . AddLinks ( Links . Find ( ) ) ) ;
82+ . AddLinks ( Links . Find ( ) ) )
83+ {
84+ Headers = { [ Constants . Headers . ETag ] = new [ ] { $@ """{ message . StreamVersion } ;{ message . Position } """ } }
85+ };
8386 }
8487
8588 public async Task<Response> DeleteMessage(
You can’t perform that action at this time.
0 commit comments