-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an option
event_headers_style
to PostAgent
It is defaulted to `capitalized`, normalizing emitted headers by capitalizing the names so downstream agents don't need to bother with the letter cases. Previously, the style of header names in an emitted event would vary depending on the server and the backend HTTP library. Most notably, the `net_http` backend downcases header names whereas other backends do not. For backward compatibility, preexisting PostAgents are automatically configured to have `event_headers_style` set to `raw` via migration.
- Loading branch information
Showing
3 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
db/migrate/20160405072512_post_agent_set_event_header_style.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class PostAgentSetEventHeaderStyle < ActiveRecord::Migration | ||
def up | ||
Agent.of_type("Agents::PostAgent").each do |post_agent| | ||
if post_agent.send(:boolify, post_agent.options['emit_events']) && | ||
!post_agent.options.key?('event_headers_style') | ||
post_agent.options['event_headers_style'] = 'raw' | ||
post_agent.save! | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters