Mercurial > p > roundup > code
diff roundup/rest.py @ 5575:7a7927643357 REST-rebased
Added OPTIONS method
Fix a bug with class response header not allowing GET
committer: Ralf Schlatterbeck <rsc@runtux.com>
| author | Chau Nguyen <dangchau1991@yahoo.com> |
|---|---|
| date | Wed, 30 Jan 2019 10:26:34 +0100 |
| parents | 55f97de157e7 |
| children | 77d11a24f718 |
line wrap: on
line diff
--- a/roundup/rest.py Wed Jan 30 10:26:34 2019 +0100 +++ b/roundup/rest.py Wed Jan 30 10:26:34 2019 +0100 @@ -224,6 +224,15 @@ def patch_element(self, class_name, item_id, input): raise NotImplementedError + def options_collection(self, class_name, input): + return 204, "" + + def options_element(self, class_name, item_id, input): + self.client.setHeader("Accept-Patch", + "application/x-www-form-urlencoded, " + "multipart/form-data") + return 204, "" + def dispatch(self, method, uri, input): # PATH is split to multiple pieces # 0 - rest @@ -253,9 +262,9 @@ try: if resource_uri in self.db.classes: self.client.setHeader("Allow", - "HEAD, OPTIONS, POST, DELETE") + "HEAD, OPTIONS, GET, POST, DELETE") self.client.setHeader("Access-Control-Allow-Methods", - "HEAD, OPTIONS, POST, DELETE") + "HEAD, OPTIONS, GET, POST, DELETE") response_code, output = getattr(self, "%s_collection" % method.lower())( resource_uri, input) else:
