Skip to content

Commit

Permalink
Guard against missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsoncoding committed Jun 19, 2024
1 parent d7392c8 commit aa30999
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/broadway_cloud_pub_sub/pull_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ defmodule BroadwayCloudPubSub.PullClient do
%{message | "data" => Base.decode64!(encoded_data)}
end

defp decode_message(%{"data" => nil} = message), do: message
defp decode_message(%{"attributes" => %{"payloadFormat" => "NONE"}} = message), do: message
defp decode_message(message) when is_map(message) and not is_map_key(message, "data"), do: message

defp headers(config) do
token = get_token(config)
Expand Down

0 comments on commit aa30999

Please sign in to comment.