@@ -16,6 +16,7 @@ feature {NONE} -- Initialization
16
16
-- Initialize `Current'.
17
17
do
18
18
create {LIBCURL_HTTP_CLIENT_SESSION } client .make (a_service ) -- "http://jfiat.dyndns.org:8190")
19
+ client .set_timeout (25 )
19
20
end
20
21
21
22
feature -- Access
@@ -71,6 +72,7 @@ feature -- Access
71
72
if l_ctx = Void then
72
73
create l_ctx .make
73
74
end
75
+ l_ctx .add_header (" Accept" , " application/vnd.collection+json" )
74
76
l_ctx .add_header (" Content-Type" , " application/vnd.collection+json" )
75
77
76
78
if attached cj_template_to_json (tpl ) as j then
@@ -112,6 +114,8 @@ feature -- Access
112
114
create l_ctx .make
113
115
end
114
116
l_ctx .add_header (" Content-Type" , " application/vnd.collection+json" )
117
+ l_ctx .add_header (" Accept" , " application/vnd.collection+json" )
118
+
115
119
116
120
if attached cj_template_to_json (tpl ) as j then
117
121
d := " { %" template %" : " + j .representation + " }"
@@ -151,6 +155,8 @@ feature -- Access
151
155
create l_ctx .make
152
156
end
153
157
l_ctx .add_header (" Content-Type" , " application/vnd.collection+json" )
158
+ l_ctx .add_header (" Accept" , " application/vnd.collection+json" )
159
+
154
160
155
161
if attached q .data as q_data then
156
162
across
@@ -185,6 +191,41 @@ feature -- Access
185
191
end
186
192
187
193
194
+ delete (a_path : READABLE_STRING_GENERAL ; ctx : detachable HTTP_CLIENT_REQUEST_CONTEXT ): CJ_CLIENT_RESPONSE
195
+ local
196
+ l_http_response : STRING_ 8
197
+ j_body : like json
198
+ l_formatted_body : detachable STRING_ 8
199
+ col : detachable CJ_COLLECTION
200
+ l_ctx : detachable HTTP_CLIENT_REQUEST_CONTEXT
201
+ l_url : STRING_ 8
202
+ do
203
+ create l_http_response .make_empty
204
+ l_ctx := ctx
205
+ if l_ctx = Void then
206
+ create l_ctx .make
207
+ end
208
+ l_ctx .add_header (" Accept" , " application/vnd.collection+json" )
209
+ l_url := a_path .to_string_ 8
210
+ if attached client .delete (l_url , l_ctx ) as g_response then
211
+ l_url := g_response .url
212
+ l_http_response .append (" Status: " + g_response .status .out + " %N" )
213
+ l_http_response .append (g_response .raw_header )
214
+ if attached g_response .body as l_body then
215
+ l_http_response .append (" %N%N" )
216
+ l_http_response .append (l_body )
217
+ if attached json (l_body ) as j then
218
+ j_body := j
219
+ col := cj_collection (j )
220
+ end
221
+ else
222
+ l_formatted_body := Void
223
+ end
224
+ end
225
+ create Result .make (l_url , l_http_response , j_body , col )
226
+ end
227
+
228
+
188
229
feature {NONE } -- Implementation
189
230
190
231
shared_ejson : SHARED_EJSON
0 commit comments