Redirect::to does not redirect with 302 - laravel-4

I have this code somewhere in my controller :
return Redirect::to('event/create')->withErrors($validation);
Why do I get the statusCode 200 and not 302 ?
Thanks
ps: I use Response::json() to verify

It is returning a 302 for the page that the validation errors occurs on.
But then the page you are redirected to will give you a status of 200 (because it loads correctly) - so when you run Response::json() on that page you get 200.
You can test in your browser developer toolkit that a 302 and a 200 is thrown:

Related

jmeter dont foud the path while is woring in the browser

i can't get a path response in jmter (http://localhost:3000/X) the reponse message is "not found" with 404 cod,while the path (http://localhost:3000) is working with 200 code any one to help please
you can click to see the response of each path
http://localhost:3000
http://localhost:3000/X
So what?
If you open https://stackoverflow.com/ in JMeter or browser you will get HTTP Status Code 200
If you open https://stackoverflow.com/X in JMeter or browser you will get HTTP Status Code 404 because this URL doesn't have any candidate page.
If you expect the non-existent page to return HTTP status code 404 and don't want JMeter to mark this result as failed - add a Response Assertion as a child of this request and configure it like:

Laravel 5.1 random 404 errors

I am using laravel 5.1 framework, I have set up my site using WAMP.
I have handled the errors whoops as it is giving response header except 200 OK.
Now the problem here is,
sometimes existing routes [i.e. working the very next moment if I try] return 404 page with response header 200 OK.
I am unable to figure it out that in which case it is returning 404 page.
Note that I have my own 404 page designed which I found in the response.
My controller code is as below:
public function create($program_id)
{
$projects = $this->mock->mockprojectlist($program_id);
return view('mocks.create', compact('program_id', 'projects'));
}
Can anyone help me with this?

Unintuitive behaviour of Poltergeist's `page.status_code`

We have a feature:
#smoke #acceptance
Scenario: Home page is available
When I visit the home page url
Then I expect no error code
With the final line implemented as:
Then(/^I expect no error code$/) do
expect(page.status_code).to eq 200
end
This sometimes fails. When debugging we've found the following:
the page itself always responds with 200
however, one resource within the page sometimes responds with 204
(which causes the test to fail)
This suggests that page.status_code does not equal the status code of the actual URL requested, but could be set to the status code of any (or presumably the last?) of the resources requested by the page.
Is this the correct explanation, and is it the expected behaviour of page.status_code?
Notes:
I realise that 204 could be construed as success, but this is not the
focus of this issue
status_code returns the result of the last request that triggered the phantomjs onLoadStarted callback - this should be the page, or potentially ajax requests initiated by the page -- it should not be assets being loaded directly as resources on the page (img, javascripts, css, etc). If it is a dependent asset then phantomjs has an issue and should be reported with reproducible example on that project. What type of request is reporting with a 204 response? If it's an ajax request then it is as expected - if not then its a bug in phantomjs. Note: checking response codes when using Capybara really is an anti-pattern, and you should generally stick to testing visible changes on the page.

JMeter failed url attempts followed by correct url for HTTP Request

How can I get JMeter to only attempt 1 url instead of 5 each time I run a test?
I am using a different site which is internal, but let's say I was using "blah.com" for the sake of discussion.
I see this in the View Results Tree:
http://blah.com
https://blah.com
https://blah.com/abc
http://blah.com/abc
https://blah.com/abc
In the same order, here are my http response codes:
301 Moved permenantly
301 Moved permenantly
302 Found
301 Moved permenantly
200 Ok
If I want Jmeter to just go straight to the 5th one so that I get the 200 code right away, what do I have to do in JMeter settings?
I have:
HTTP Cookie Manager
HTTP Cache Manager
HTTP Request ( with "blah.com" filled in for the server name )
under HTTP Request, I have all of these:
HTTP Header Manager
Response Assertion ( with some url patterns checking for html tags - I just copied the html from View Source and pasted it in as a url pattern...these all seem to work )
Response Assertion ( just checking response code - I chose Response Code and entered "200"...this also seems to work )
Summary Report
I was able to get this down to 1. Adjustments made to the HTTP Request:
I added "/abc" to "Path" and changed "Follow Redirects" to "Redirect Automatically".

classic asp response code

We currently have a classic asp 404 error page. By default, it's returning a status code 200 error, and we want it to return a 404 error code. How do you set the status code for a page in classic asp (vbscript)?
Use the Response object:
Response.Status = "404 Not found"
Technically, 200 is a status code OK, not an error, but nevertheless, the basic idea is that you need to tell the Response stream to return 404 (Not found) for the status code. Here's one way to do that.

Resources