@@ -78,14 +78,16 @@ def do_response(endpoint, req_args, error='', **args):
7878 if error :
7979 if _response_placement == 'body' :
8080 _log .info ('Error Response: {}' .format (info ['response' ]))
81- resp = make_response (info ['response' ], 400 )
81+ _http_response_code = info .get ('response_code' , 400 )
82+ resp = make_response (info ['response' ], _http_response_code )
8283 else : # _response_placement == 'url':
8384 _log .info ('Redirect to: {}' .format (info ['response' ]))
8485 resp = redirect (info ['response' ])
8586 else :
8687 if _response_placement == 'body' :
8788 _log .info ('Response: {}' .format (info ['response' ]))
88- resp = make_response (info ['response' ], 200 )
89+ _http_response_code = info .get ('response_code' , 200 )
90+ resp = make_response (info ['response' ], _http_response_code )
8991 else : # _response_placement == 'url':
9092 _log .info ('Redirect to: {}' .format (info ['response' ]))
9193 resp = redirect (info ['response' ])
@@ -166,10 +168,14 @@ def registration():
166168 current_app .server .server_get ("endpoint" , 'registration' ))
167169
168170
169- @oidc_op_views .route ('/registration_api' , methods = ['GET' ])
171+ @oidc_op_views .route ('/registration_api' , methods = ['GET' , 'DELETE' ])
170172def registration_api ():
171- return service_endpoint (
172- current_app .server .server_get ("endpoint" , 'registration_read' ))
173+ if request .method == "DELETE" :
174+ return service_endpoint (
175+ current_app .server .server_get ("endpoint" , 'registration_delete' ))
176+ else :
177+ return service_endpoint (
178+ current_app .server .server_get ("endpoint" , 'registration_read' ))
173179
174180
175181@oidc_op_views .route ('/authorization' )
@@ -245,10 +251,14 @@ def service_endpoint(endpoint):
245251 err_msg = ResponseMessage (error = 'invalid_request' , error_description = str (err ))
246252 return make_response (err_msg .to_json (), 400 )
247253
248- _log .info ('request: {}' .format (req_args ))
249254 if isinstance (req_args , ResponseMessage ) and 'error' in req_args :
250- return make_response (req_args .to_json (), 400 )
255+ _log .info ('Error response: {}' .format (req_args ))
256+ _resp = make_response (req_args .to_json (), 400 )
257+ if request .method == "POST" :
258+ _resp .headers ["Content-type" ] = "application/json"
259+ return _resp
251260 try :
261+ _log .info ('request: {}' .format (req_args ))
252262 if isinstance (endpoint , Token ):
253263 args = endpoint .process_request (AccessTokenRequest (** req_args ), http_info = http_info )
254264 else :
0 commit comments