@@ -71,7 +71,23 @@ module.exports = testCase
71
71
fetch ' GET' , @port , " /doc/#{ @name } " , null , (res , data ) ->
72
72
test .strictEqual (res .statusCode , 404 )
73
73
test .done ()
74
+
75
+ ' return 404 and empty body when on HEAD on a nonexistant document ' : (test ) ->
76
+ fetch ' HEAD' , @port , " /doc/#{ @name } " , null , (res , data ) ->
77
+ test .strictEqual res .statusCode , 404
78
+ test .strictEqual data, ' '
79
+ test .done ()
74
80
81
+ ' return 200, empty body, version and type when on HEAD on a document ' : (test ) ->
82
+ @model .create @name , ' simple' , =>
83
+ @model .applyOp @name , {v : 0 , op : {position : 0 , text : ' Hi' }}, =>
84
+ fetch ' HEAD' , @port , " /doc/#{ @name } " , null , (res , data , headers ) ->
85
+ test .strictEqual res .statusCode , 200
86
+ test .strictEqual headers[' x-ot-version' ], ' 1'
87
+ test .strictEqual headers[' x-ot-type' ], ' simple'
88
+ test .strictEqual data, ' '
89
+ test .done ()
90
+
75
91
' GET a document returns the document snapshot ' : (test ) ->
76
92
@model .create @name , ' simple' , =>
77
93
@model .applyOp @name , {v : 0 , op : {position : 0 , text : ' Hi' }}, =>
0 commit comments