Skip to content

Commit 8e9301a

Browse files
committed
Added OPTIONS method
Fix a bug with class response header not allowing GET committer: Ralf Schlatterbeck <[email protected]>
1 parent 70eaf35 commit 8e9301a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

roundup/rest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ def patch_collection(self, class_name, input):
224224
def patch_element(self, class_name, item_id, input):
225225
raise NotImplementedError
226226

227+
def options_collection(self, class_name, input):
228+
return 204, ""
229+
230+
def options_element(self, class_name, item_id, input):
231+
self.client.setHeader("Accept-Patch",
232+
"application/x-www-form-urlencoded, "
233+
"multipart/form-data")
234+
return 204, ""
235+
227236
def dispatch(self, method, uri, input):
228237
# PATH is split to multiple pieces
229238
# 0 - rest
@@ -253,9 +262,9 @@ def dispatch(self, method, uri, input):
253262
try:
254263
if resource_uri in self.db.classes:
255264
self.client.setHeader("Allow",
256-
"HEAD, OPTIONS, POST, DELETE")
265+
"HEAD, OPTIONS, GET, POST, DELETE")
257266
self.client.setHeader("Access-Control-Allow-Methods",
258-
"HEAD, OPTIONS, POST, DELETE")
267+
"HEAD, OPTIONS, GET, POST, DELETE")
259268
response_code, output = getattr(self, "%s_collection" % method.lower())(
260269
resource_uri, input)
261270
else:

0 commit comments

Comments
 (0)