-
Notifications
You must be signed in to change notification settings - Fork 50
New coerce_input class type check breaks tests #37
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
Comments
I agree, we have to think about other way of doing this. Maybe just check existence of some core methods for uploaded file object. Or rollback this feature at all. |
[workaround] I tried to wrap ActionDispatch::Http::UploadedFile object as an argument (not Hash argment.) Then it worked fine. before query = "..."
variables = {
file: fixture_file_upload("image.png")
}
Schema.execute(query, {}, variables) after query = "..."
variables = {
file: ::ApolloUploadServer::Wrappers::UploadedFile.new(fixture_file_upload("image.png"))
}
Schema.execute(query, {}, variables) |
if someone wants to actually use a file passed in variables to file = ::ApolloUploadServer::Wrappers::UploadedFile.new(Rack::Test::UploadedFile.new("<file_path>", 'image/png'))
allow(ApolloUploadServer::Upload).to receive(:coerce_input).and_return(file)
variables = {
...
file: file
},
Schema.execute(query, {}, variables) otherwise, it comes as an array |
I'm trying to upgrade from 2.0.1 to 2.0.3. There was a check added in
coerce_input
that force the value to be of a certain type. My tests work fine prior to that.Here's my working solution on 2.0.1
After 2.0.3 I get the following error:
"#<ActionDispatch::Http::UploadedFile:0x0000562e5512a028 @tempfile=#<File:/home/circleci/project/spec/data/lolcat.png>, @original_filename=\"lolcat.png\", @content_type=\"image/png\", @headers=nil> is not a valid upload"
I tried wrapping my helper in your wrapper class like such:
But it yields a different error:
Willing to provide more information if needed. Hoping it's a quick fix on your end. I'm unsure why there's a
is_a?
class check. If it quacks like a duck, it should just be fine. Unsure about theas_json
override either.The text was updated successfully, but these errors were encountered: