sul-dlss / sdr-client

SDR API client (in Ruby)
https://sul-dlss.github.io/sdr-api/
Other
0 stars 1 forks source link

handle invalid json and content type cleanup #284

Closed peetucket closed 1 year ago

peetucket commented 1 year ago

Why was this change made? 🤔

Push content type cleanup and setting from H2 into the client so all consumers can benefit.

Part of sul-dlss/happy-heron#3075

Goes with https://github.com/sul-dlss/sdr-api/pull/585 Replaces https://github.com/sul-dlss/happy-heron/pull/3082

How was this change tested? 🤨

New tests added and in QA with H2

peetucket commented 1 year ago

I might not be understanding this, but it appears to me this will mangle content types NOT in any of the three specific cases in clean_content_type.

There are two special cases, the last line just strips anything after a ; from the supplied content_type (which was happening before in H2). It shouldn't mangle anything that doesn't have semi-colons, or isn't blank, or isn't our special JSON type. There are new tests for all of those cases as well.

ndushay commented 1 year ago

I might not be understanding this, but it appears to me this will mangle content types NOT in any of the three specific cases in clean_content_type.

There are two special cases, the last line just strips anything after a ; from the supplied content_type (which was happening before in H2). It shouldn't mangle anything that doesn't have semi-colons, or isn't blank, or isn't our special JSON type. There are new tests for all of those cases as well.

ok, great. Maybe the comment can be outside the method and make that clearer?