atecarlos / protractor-http-mock

A library designed to work alongside Protractor for setting up mocks for your HTTP ajax requests.
MIT License
173 stars 70 forks source link

Method case causes unmached requests #37

Closed josephdpurcell closed 9 years ago

josephdpurcell commented 9 years ago

The method that gets specified in the mock file must match the case that is specified in the application.

Angular Request

$http({
  method: 'get',
  url: '/api/v1.0/access-token',
  headers: {
    'Authorization': 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
  }
})

Mock File

{
  "request": {
    "method": "GET",
    "path": "/api/v1.0/access-token",
    "headers": {
      "Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
    }
  },
  "response": {
    "access_token": "P6AlGY9SZSUlw3K0bZteiTp32UP-IOYv49aJNDWZbKQ",
    "type": "Bearer",
    "expires_in": 72204,
    "refresh_token": "u8iBLUb6-sPttALigZZRS4wC-uAuICEd3-8iohDXeiU"
  }
}

Conclusion

I think expecting the writer of the mock to use the same case as is used in the Angular app isn't completely unreasonable, but it should be communicated to the developer that is the case.

What are your thoughts?

atecarlos commented 9 years ago

Hi @josephdpurcell . Yes, actually, I completely expect the plugin to ignore the case. I have a few examples and specs that check that this is working. Perhaps, there is something else that is causing this to not match?

josephdpurcell commented 9 years ago

Yes, apologies, it looks like this is not an issue.