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

Implement class method to return last HTTP response #32

Merged
merged 2 commits into from
Apr 7, 2014

Conversation

moznion
Copy link
Contributor

@moznion moznion commented Apr 2, 2014

Suggested here but it has not be implemented yet.

By the way, must $RESPONSE be global variable? It seems to me that it should be a member variable of the instance, how?

@tokuhirom
Copy link
Owner

Normally, people want to use this module like wq('http://mixi.jp/')->find('h1') or die #Web::Query::RESPONSE->status_line. Then, class method is needed.

@moznion
Copy link
Contributor Author

moznion commented Apr 6, 2014

I see.

Perhaps, should I fix documentation instead of source code? Is it better?

@@ -19,14 +19,14 @@ $ua->add_handler(request_send => sub {
subtest 'bad status code' => sub {
my $q = wq('http://bad.com/');
is($q, undef);
isa_ok($Web::Query::RESPONSE, 'HTTP::Response');
Copy link
Owner

Choose a reason for hiding this comment

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

You should not remove test case for $Web::Query::RESPONSE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored!

@tokuhirom
Copy link
Owner

You can add $wq->response as the instance method.

@moznion
Copy link
Contributor Author

moznion commented Apr 7, 2014

Well, on second thought, Web::Query::new_from_url() returns undef if HTTP response is failed, thus I feel the instance method to return response is not needed...

tokuhirom added a commit that referenced this pull request Apr 7, 2014
Implement class method to return last HTTP response
@tokuhirom tokuhirom merged commit 0a64cfe into tokuhirom:master Apr 7, 2014
@moznion moznion deleted the last_response branch April 7, 2014 05:09
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.

2 participants