@@ -299,30 +299,44 @@ async def post_account_recent(
299299 "/marge/streaming/account/{account}/device/" ,
300300 response_class = BoseXMLResponse ,
301301 tags = ["marge" ],
302+ status_code = HTTPStatus .CREATED ,
302303 dependencies = [
303304 Depends (
304305 Etag (
305306 etag_gen = etag_for_account ,
306307 weak = False ,
308+ extra_headers = {
309+ "method_name" : "addDevice" ,
310+ "access-control-expose-headers" : "Credentials" ,
311+ },
307312 )
308313 )
309314 ],
310315)
311316async def post_account_device (
312- account : Annotated [str , Path (pattern = ACCOUNT_RE )], request : Request
317+ account : Annotated [str , Path (pattern = ACCOUNT_RE )],
318+ request : Request ,
313319):
314320 xml = await request .body ()
315- xml_resp = add_device_to_account (datastore , account , xml )
321+ device_id , xml_resp = add_device_to_account (datastore , account , xml )
322+
316323 return bose_xml_str (xml_resp )
317324
318325
319- @app .delete ("/marge/streaming/account/{account}/device/{device}/ " , tags = ["marge" ])
326+ @app .delete ("/marge/streaming/account/{account}/device/{device}" , tags = ["marge" ])
320327async def delete_account_device (
321328 account : Annotated [str , Path (pattern = ACCOUNT_RE )],
322329 device : Annotated [str , Path (pattern = DEVICE_RE )],
330+ response : Response ,
323331):
324332 xml_resp = remove_device_from_account (datastore , account , device )
325- return {"ok" : True }
333+ response .headers ["method_name" ] = "removeDevice"
334+ response .headers ["location" ] = (
335+ f"{ settings .base_url } /marge/account/{ account } /device/{ device } "
336+ )
337+ response .body = ""
338+ response .status_code = HTTPStatus .OK
339+ return response
326340
327341
328342@app .get ("/bmx/registry/v1/services" , response_model_exclude_none = True , tags = ["bmx" ])
0 commit comments