message: 204 + null === explosions.
diff: @@ -5,13 +5,23 @@ export function handleErrors(response: Response) {
  throw new Error(t('DtrReview.ServiceCallError'));
  }
  - return response.json();
  + return response.text().then((text) => {
  + return text ? JSON.parse(text) : {};
  + });
  }
  +/**
  + * Handle submit errors.
  + * In D1, they return a 204 status and a null body to indicate that submission was succesful.
  + * Simply parsing a null body is pretty explosive!
  + */
  export function handleSubmitErrors(response: Response) {
  if (response.status !== 204) {
  throw new Error(t('DtrReview.ServiceSubmitError'));
  }
  - return response.json();
  + // https://github.com/github/fetch/issues/268
  + return response.text().then((text) => {
  + return text ? JSON.parse(text) : {};
  + });
  }
  