Skip to content

Commit e0ffb40

Browse files
author
Christer van der Meeren
committed
Add test
1 parent 668c154 commit e0ffb40

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Felicity.IntegrationTests/SkipLinks.fs

+17
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ module A =
3030

3131
let toMany = define.Relationship.ToMany(resDef).Get(fun _ -> [])
3232

33+
let post = define.Operation.Post(fun () -> A)
34+
3335
let get = define.Operation.GetResource()
3436

3537
let customOp =
@@ -208,4 +210,19 @@ let tests =
208210
Expect.isTrue (json |> hasNoPath "errors[2]") ""
209211
}
210212

213+
testJob "Has Location header in POST response even if resource link is skipped" {
214+
let client = getClient ()
215+
216+
let! response =
217+
Request.createWithClient client Post (Uri("http://example.com/as?skipAllLinks"))
218+
|> Request.jsonApiHeaders
219+
|> Request.bodySerialized {| data = {| ``type`` = "a" |} |}
220+
|> getResponse
221+
222+
response |> testSuccessStatusCode
223+
let! json = response |> Response.readBodyAsString
224+
Expect.isFalse (json |> hasPath "data.links") ""
225+
Expect.isTrue (response.headers.TryFind Location = Some "http://example.com/as/1") ""
226+
}
227+
211228
]

0 commit comments

Comments
 (0)