Skip to content

Commit

Permalink
Rest API: removed some configs after adding them to upstream rest-fra…
Browse files Browse the repository at this point in the history
…mework
  • Loading branch information
lalithkota committed Feb 29, 2024
1 parent 1939fe1 commit d478f69
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions g2p_registry_rest_api/http.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

from werkzeug.exceptions import BadRequest, HTTPException, InternalServerError
from werkzeug.exceptions import BadRequest, InternalServerError

import odoo
from odoo.http import Root
Expand All @@ -14,8 +14,6 @@


def g2pFixException(exception, original_exception=None):
get_original_headers = HTTPException(exception).get_headers

def get_body(environ=None, scope=None):
if original_exception and isinstance(original_exception, G2PApiException):
res = G2PErrorResponse(
Expand All @@ -36,15 +34,6 @@ def get_body(environ=None, scope=None):
res.update({"traceback": exception.traceback})
return JSONEncoder().encode(res)

def get_headers(environ=None, scope=None):
"""Get a list of headers."""
_headers = [("Content-Type", "application/json")]
for key, value in get_original_headers(environ=environ, scope=scope):
if key != "Content-Type":
_headers.append(key, value)
return _headers

exception.get_headers = get_headers
exception.get_body = get_body
return exception

Expand Down

0 comments on commit d478f69

Please sign in to comment.