Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against missing data #101

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
josevalim marked this conversation as resolved.
Show resolved Hide resolved
josevalim marked this conversation as resolved.
Show resolved Hide resolved

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