Skip to content

Commit

Permalink
CIPropertyDelegate: Fix issue where status field was omitted from suc…
Browse files Browse the repository at this point in the history
…cessful PE response headers
  • Loading branch information
reuk committed Nov 27, 2023
1 parent 968fa96 commit b4aa74b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions modules/juce_midi_ci/ci/juce_CIPropertyDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@ struct PropertyDelegateDetail
static auto getSubscribeId (const PropertyRequestHeader&) { return String{}; }
static auto getSubscribeId (const PropertyReplyHeader&) { return String{}; }

static auto getStatus (const PropertySubscriptionHeader&) { return 0; }
static auto getStatus (const PropertyRequestHeader&) { return 0; }
static auto getStatus (const PropertyReplyHeader& h) { return h.status; }
static std::optional<int> getStatus (const PropertySubscriptionHeader&) { return {}; }
static std::optional<int> getStatus (const PropertyRequestHeader&) { return {}; }
static std::optional<int> getStatus (const PropertyReplyHeader& h) { return h.status; }

template <typename T>
static auto toFieldsFromHeader (const T& t)
{
auto fields = t.extended;

// Status shall always be included if it is present in the header
if (const auto status = getStatus (t))
fields["status"] = *status;

if (getResource (t) != getResource (T()))
fields["resource"] = getResource (t);

Expand All @@ -199,9 +203,6 @@ struct PropertyDelegateDetail
if (t.mediaType != T().mediaType)
fields["mediaType"] = t.mediaType;

if (getStatus (t) != getStatus (T()))
fields["status"] = getStatus (t);

if (getSetPartial (t))
fields["setPartial"] = true;

Expand Down

0 comments on commit b4aa74b

Please sign in to comment.