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

Discover and include mime type when attaching files. #149

Merged
merged 6 commits into from
Dec 19, 2014

Conversation

bpedro
Copy link
Contributor

@bpedro bpedro commented Oct 1, 2014

  • Added mime type discovery to the attach() method so that the file mime type is sent on the request.
  • Mime types are found using finfo_open(FILEINFO_MIME_TYPE) and then doing a finfo_file() on each of the attached files.
  • Mime types will be used with the curl_file_create() function or with the regular curl @.
  • Changed the test so that is uses a real file (an image), checking if the correct mime type is found and used.

@@ -322,13 +322,13 @@ function testParsingContentTypeUpload()

function testAttach() {
$req = Request::init();

$req->attach(array('index' => '/dir/filename'));
$filename = 'test_image.jpg';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a bad idea to have this be a fully quantified path to be safe. I believe if the test is run a la carte from another directory, it would break. Correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated the code to use a full path.

nategood pushed a commit that referenced this pull request Dec 19, 2014
Discover and include mime type when attaching files.
@nategood nategood merged commit 72a808b into nategood:master Dec 19, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants