From 70c87ea7709ad550c1feaaf7d3831e85d52c032f Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Tue, 4 Dec 2018 13:04:56 -0500 Subject: Include the gem version in the user agent string --- lib/action_mailbox/postfix_relayer.rb | 3 ++- test/unit/postfix_relayer_test.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/action_mailbox/postfix_relayer.rb b/lib/action_mailbox/postfix_relayer.rb index 5a0eb7dca3..eae6184fbb 100644 --- a/lib/action_mailbox/postfix_relayer.rb +++ b/lib/action_mailbox/postfix_relayer.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "action_mailbox/version" require "net/http" require "uri" @@ -16,7 +17,7 @@ module ActionMailbox end CONTENT_TYPE = "message/rfc822" - USER_AGENT = "Action Mailbox Postfix relayer" + USER_AGENT = "Action Mailbox Postfix relayer v#{ActionMailbox::VERSION}" attr_reader :uri, :username, :password diff --git a/test/unit/postfix_relayer_test.rb b/test/unit/postfix_relayer_test.rb index 550ed2ac7f..9d6e49dee3 100644 --- a/test/unit/postfix_relayer_test.rb +++ b/test/unit/postfix_relayer_test.rb @@ -21,7 +21,7 @@ module ActionMailbox assert_requested :post, URL, body: file_fixture("welcome.eml").read, basic_auth: [ "actionmailbox", INGRESS_PASSWORD ], - headers: { "Content-Type" => "message/rfc822", "User-Agent" => "Action Mailbox Postfix relayer" } + headers: { "Content-Type" => "message/rfc822", "User-Agent" => /\AAction Mailbox Postfix relayer v\d+\./ } end test "unsuccessfully relaying with invalid credentials" do -- cgit v1.2.3