var d = Object.defineProperty;
var m = (o, n) => d(o, "name", { value: n, configurable: !0 });
import { Code as y } from "../code.js";
import { codeFromHttpStatus as u } from "./http-status.js";
import { ConnectError as f } from "../connect-error.js";
import { parseContentType as c } from "./content-type.js";
import { headerContentType as l } from "./headers.js";
import { MethodKind as s } from "../../../../../../../@bufbuild_protobuf@1.10.0/node_modules/@bufbuild/protobuf/dist/esm/service-type.js";
function F(o, n, t, e) {
  const i = e.get(l), r = c(i);
  if (t !== 200) {
    const a = new f(`HTTP ${t}`, u(t), e);
    if (o == s.Unary && r && !r.binary)
      return { isUnaryError: !0, unaryError: a };
    throw a;
  }
  const p = {
    binary: n,
    stream: o !== s.Unary
  };
  if (r?.binary !== p.binary || r.stream !== p.stream)
    throw new f(`unsupported content type ${i}`, r === void 0 ? y.Unknown : y.Internal, e);
  return { isUnaryError: !1 };
}
m(F, "validateResponse");
export {
  F as validateResponse
};
