~srushe/ho-tan

e1340e66d81ddd395bbf0159eda8506ed10046db — Stephen Rushe 2 years ago c01ca89 + 9d0e18c
Merge pull request #1 from srushe/restore-access-token-filtering

Restore clearing of access token before create
2 files changed, 8 insertions(+), 1 deletions(-)

M lib/ho_tan/post/normalize.rb
M spec/lib/ho_tan/post/normalize_spec.rb
M lib/ho_tan/post/normalize.rb => lib/ho_tan/post/normalize.rb +6 -0
@@ 9,6 9,8 @@ module HoTan

      class << self
        def for_create(params)
          params = params.reject { |k, _v| ignorable_create_parameters.include?(k) }

          if url_encoded_create?(params)
            url_encoded_create_data_from(params)
          elsif json_create?(params)


@@ 53,6 55,10 @@ module HoTan
          create_data['properties']['published'] ||= [Time.now.utc.iso8601]
          create_data
        end

        def ignorable_create_parameters
          %w[access_token]
        end
      end
    end
  end

M spec/lib/ho_tan/post/normalize_spec.rb => spec/lib/ho_tan/post/normalize_spec.rb +2 -1
@@ 34,7 34,8 @@ RSpec.describe HoTan::Post::Normalize do
          'h' => h_value,
          'content' => 'hello world',
          'category' => %w[foo bar],
          'photo' => 'https://photos.example.com/592829482876343254.jpg'
          'photo' => 'https://photos.example.com/592829482876343254.jpg',
          'access_token' => 'a-valid-token'
        }
      end