Questions tagged [httpbackend]

`$httpBackend` is a fake HTTP backend implementation suitable for unit testing applications that use the `$http` service in Angular.js.

$httpBackend is a fake HTTP backend implementation suitable for unit testing applications that use the $http service in Angular.js.

222 questions
1
vote
0 answers

How to test angularJs http request jsonp

So, i am trying to follow this tutorial while trying to create some unit tests along the way. Well i am stuck at trying to test the $http request to the ergast developer api. As u can see in the tutorial the $http request is made to the service…
hanto899
  • 103
  • 1
  • 6
1
vote
0 answers

Angular testing wrong url in order to call error callback and test it

I want to test an HTTP post error callback. In fact I have this code: $http.post(url, $.param(postData)).success(function(data, status, headers, config){ if (data == "ok") { $(location).attr('href',…
hanane
  • 64
  • 1
  • 9
1
vote
1 answer

am I mocking httpBackend correctly?

Unit tests: describe "Lunch controller", -> beforeEach module('Lunch') beforeEach inject(($httpBackend) -> $httpBackend.expectGET('/lunchers') .respond(200, ["some content", "some other content"]) ) describe "LunchCtrl", -> it…
John
  • 1,246
  • 15
  • 34
1
vote
1 answer

Angularjs unit test with $rootScope and $httpBackend

I have a service which fires a HTTP request. This request makes use of the $rootScope.config object (there is my base url stored), but for some reason when I use $httpBackend, $rootScope is not loaded correct. Service: myAppServices.factory('Auth',…
Daan
  • 7,685
  • 5
  • 43
  • 52
1
vote
1 answer

How can I define a global $httpBackend for servicesSpec and controllersSpec in AngularJS?

My controller relies on a service which does http requests. Both controller and service tests require the httpBackend with the same data. Do you have any idea of a workaround?
poiuytrez
  • 21,330
  • 35
  • 113
  • 172
0
votes
1 answer

How to replace port 8000

I'm working on a project now and I'm currently using Django+uWSGI+Nginx to deploy the backend on the server. There is also a frontend using Vue.js on the same server. So the frontend is www.mysite.com The backend uses port 8000 as…
ji pei
  • 1
0
votes
1 answer

Node Benchmarking tool to examine the sub requests/methods timing

I used the apache bench , siege and benchmark.js for the benchmarking, load test to examine.But these tools/libraries gave the overall result/time which took from start to end. I want the execution time for all the sub methods or requests calling…
Mudasser
  • 11
  • 4
0
votes
0 answers

How to get a token from the backend in Angular2 when using separate development?

The backend returns the token in the html code and I can't get it out Angular2 has its own page index.html in development mode (called ng serve)
d689440
  • 51
  • 2
0
votes
1 answer

Nest JS Exception Overrides Pipe Implementation in all levels both global and local

click to see code snippet I am implementing validation in my nestjs project and i implemented Http Exception Handler on the global scope previously . Then i Used the ValidationPipe class for input validation but its gets overridden by exception…
0
votes
0 answers

in typescript env, I create HttpException that derive class of Error, use it at my express error handler

why it can use without new HttpException() then trown a error I saw this method elsewhere,and it is work Here is HttpException class HttpException extends Error{ constructor(public status: number,public message: string){ super(message); …
BuzzWoods
  • 11
  • 1
0
votes
1 answer

Invalid HTTP Header in a response

I have some URL and make a request to that URL but a response is invalid. I checked requests in Chrome dev tools and Chrome didn't find something wrong. I make a request in Postman but I receive "Parse Error: There seems to be an invalid character…
0
votes
2 answers

Saving multiple api response in a single object in Ruby

I have a scenario where I need to convert multiple API responses into one object. Is it possible how? Below is my code. How do I convert it into one single object? require 'httparty' require 'json' def make_request(url) HTTParty.get(url, headers:…
0
votes
1 answer

Deploy Go backend HTTP API in AWS

I would like to communicate a nextjs application deployed at Vercel to a HTTPS API backend in golang that is deployed in AWS ECS. I am thinking of architecture without a load balancer to minimize the project cost. Can I expose an API in an ECS…
Lohmann
  • 89
  • 2
  • 9
0
votes
2 answers

how to stop people from sharing your website page link?

Is there a way for to make a page link on my website non-shareable, that is, if I share a link to this page with anyone else will not be able to access it, it can only be accessed from the source
Jim
  • 3
  • 4
0
votes
1 answer

how to detect which update button was clicked with Flask python(mongoDB)

I need to develop back-end system and using(first time) Flask and mongodb for database. Basically, i need a dynamic table in a webpage with "add" button to add data to the table and "update" button for each row of data. So far, i have managed to…
user10535695