Code Repositories xandikos / 601b0ea
Report supported methods when sending 405. Jelmer Vernooń≥ 2 years ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
12991299 if r is None:
13001300 return _send_not_found(environ, start_response)
13011301 if COLLECTION_RESOURCE_TYPE not in r.resource_types:
1302 start_response('405 Method Not Allowed', [])
1303 return []
1302 return _send_method_not_allowed(
1303 environ, start_response,
1304 app._get_allowed_methods(environ))
13041305 content_type = environ['CONTENT_TYPE'].split(';')[0]
13051306 try:
13061307 (name, etag) = r.create_member(None, new_contents, content_type)
13551356 r = app.backend.get_resource(container_path)
13561357 if r is not None:
13571358 if COLLECTION_RESOURCE_TYPE not in r.resource_types:
1358 start_response('405 Method Not Allowed', [])
1359 return []
1359 return _send_method_not_allowed(
1360 environ, start_response,
1361 app._get_allowed_methods(environ))
13601362 try:
13611363 (new_name, new_etag) = r.create_member(
13621364 name, new_contents, content_type)
14961498 raise UnsupportedMediaType(content_type)
14971499 href, path, resource = app._get_resource_from_environ(environ)
14981500 if resource is not None:
1499 start_response('405 Method Not Allowed', [])
1500 return []
1501 return _send_method_not_allowed(
1502 environ, start_response,
1503 app._get_allowed_methods(environ))
15011504 try:
15021505 resource = app.backend.create_collection(path)
15031506 except FileNotFoundError:
15411544 raise UnsupportedMediaType(base_content_type)
15421545 href, path, resource = app._get_resource_from_environ(environ)
15431546 if resource is not None:
1544 start_response('405 Method Not Allowed', [])
1545 return []
1547 return _send_method_not_allowed(
1548 environ, start_response,
1549 app._get_allowed_methods(environ))
15461550 try:
15471551 resource = app.backend.create_collection(path)
15481552 except FileNotFoundError: