Skip to content

Commit

Permalink
Merge pull request #871 from materialsproject/bugfix/fix_header_proce…
Browse files Browse the repository at this point in the history
…ssing

Fix header processing with enabled validation
  • Loading branch information
munrojm committed Oct 13, 2023
2 parents 879284b + da8371e commit d32ed67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/maggma/api/resource/read_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ def get_by_key(
response = Response(orjson.dumps(response, default=serialization_helper)) # type: ignore

if self.header_processor is not None:
self.header_processor.process_header(response, request)
if self.disable_validation:
self.header_processor.process_header(response, request)
else:
self.header_processor.process_header(temp_response, request)

return response

Expand Down Expand Up @@ -269,7 +272,10 @@ def search(**queries: Dict[str, STORE_PARAMS]) -> Union[Dict, Response]:
response = Response(orjson.dumps(response, default=serialization_helper)) # type: ignore

if self.header_processor is not None:
self.header_processor.process_header(response, request)
if self.disable_validation:
self.header_processor.process_header(response, request)
else:
self.header_processor.process_header(temp_response, request)

return response

Expand Down
5 changes: 4 additions & 1 deletion src/maggma/api/resource/s3_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def get_by_key(
response = Response(orjson.dumps(response, default=serialization_helper)) # type: ignore

if self.header_processor is not None:
self.header_processor.process_header(response, request)
if self.disable_validation:
self.header_processor.process_header(response, request)
else:
self.header_processor.process_header(temp_response, request)

return response

Expand Down

0 comments on commit d32ed67

Please sign in to comment.