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

Binary Data not being stripped out on multipart upload #239

Closed
jeffutter opened this issue Oct 19, 2015 · 0 comments
Closed

Binary Data not being stripped out on multipart upload #239

jeffutter opened this issue Oct 19, 2015 · 0 comments

Comments

@jeffutter
Copy link
Contributor

I spent a few hours today trying to figure out why I was getting JSON encoding errors on my multipart-upload post doc specs. I eventually found an issue here: #202 detailing that it should be stripped out and replaced with [upload data]. I am super glad that rspec_api_documentation handles this for me, as every attempt I tried to do on my own to strip the data out via regex was coming up short.

Now that I know rspec_api_documentation was supposed to handle this form. I am still running into an issue where it is not properly stripping. I have have tracked it down to this line

"CONTENT_TYPE" => request_headers["Content-Type"],

When my test hits that line I have no Content-Type header, I have a Content_type header.

My spec looks roughly like this:

post '/photo/create' do
  let(:profile) { create(:profile) }
  let(:basic) { "Basic #{Base64.encode64(profile['token'])}:" }
  let(:event) { create(:event) }

  header "Authorization", :basic
  header "Content-Type", "multipart/form-data"

  parameter :file, "Photo File"
  parameter :original_filename, "Original Photo Filename"

  let(:file) { Rack::Test::UploadedFile.new('spec/fixtures/files/file.jpg') }
  let(:original_filename) { 'file.jpg' }

  example_request "Create a photo" do
    expect(status).to eq 200
  end
end

I can look into this more tomorrow. I wanted to drop the issue here though incase someone knew off hand what was going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant