Questions tagged [unirest]

Unirest is a set of lightweight HTTP libraries available in PHP, Ruby, Python, Java, Objective-C.

Unirest is a set of lightweight HTTP libraries available in PHP, Ruby, Python, Java, Objective-C.

More Details

354 questions
3
votes
5 answers

Mocking Unirest with mockito

I am in my starting programming phase and I wanted to ask about mocking Objects with Mockito, more specifically is the Unirest response. Let's say I have a database, and I dont what to bother it every time I do testing, and I want to use Mockito for…
Bar Lerer
  • 89
  • 3
  • 10
3
votes
2 answers

Does OkHttp have something easier similar to Unirest's field method for creating a RequestBody?

Instead of Unirest, I'm using okhttp because there are responses where I only need the header so I don't need to download it using its ResponseBody.string() method. I am however having a hard time building my requests for POSTs with a RequestBody.…
Rigo Sarmiento
  • 434
  • 5
  • 21
3
votes
1 answer

How to save octet stream received as REST response to the file system?

While trying to save octet stream JSON format response (containing data of file in a properietary format) received using Unirest client the format gets corrupted and the (properietary) software used to open that format is unable to open this saved…
Ulysses
  • 5,616
  • 7
  • 48
  • 84
3
votes
3 answers

Java Unirest disable cerificate

May you tell me the way to disable certificate verify for using Unirest as rest client. I use Unirest with Java Spring. Below is my source code: try { HttpResponse response = Unirest.post("myurl") .header("content-type",…
munyso
  • 87
  • 1
  • 2
  • 8
3
votes
1 answer

Convert unirest to curl

I want to use jsonWhois api but it makes the server request using Unirest, which looks like it's no longer maintained and I would prefer to use curl anyway. How can I convert this code to use Curl instead?? $response =…
turrican_34
  • 679
  • 1
  • 7
  • 27
3
votes
1 answer

unirest - java.lang.ClassNotFoundException: org.apache.http.nio.reactor.IOReactorException

I am trying to use Unirest-Mashape to build java applications. This is my code:import com.mashape.unirest.http.*; import com.mashape.unirest.http.HttpResponse; import org.apache.http.*; import org.json.*; public class request { public static…
3
votes
1 answer

Google Cloud Print API - white page when printing PDF

I want to send a PDF file to be printed using the Google Cloud Print API. The code bellow will give me a positive message telling me that one page was generate. When I go and check what came out, I gate an empty page. The same result happens if I…
David Gatti
  • 3,576
  • 3
  • 33
  • 64
3
votes
1 answer

Convert Curl to Unirest

This is a curl request from Stripe API curl method: curl https://api.stripe.com/v1/accounts \ -u sk_test_**********: \ -d managed=false \ -d country=US \ -d email="bob@example.com" Right now I have this unirest code:
Emily
  • 71
  • 1
  • 7
3
votes
2 answers

Unirest shutdown to exit program

I try to update resources with scheduled tasks using Unirest.get(...).asObjectAsync(...). To stop a program employing Unirest, you need to call Unirest.shutdown(); to exit its event loops and clients. However, if some threads call Unirest's request…
Sebastian Höffner
  • 1,864
  • 2
  • 26
  • 37
3
votes
1 answer

Convert the http response body to JSON format using Unirest C#

I am using mashape api: https://market.mashape.com/montanaflynn/dictionary Here's my code: HttpResponse response = Unirest.get("https://montanaflynn-dictionary.p.mashape.com/define?word=irony") .header("X-Mashape-Key", "my mashape…
Tomer
  • 61
  • 5
3
votes
1 answer

php how to pass authorization bearer in unirest

i have unirest code running in laravel 4.2: (doesn't work) // and…
user4612911
3
votes
1 answer

Unirest POST request won't run in PHP

I have a block of code that's almost as barebones as it gets, but for some reason, it just refuses to run:
Code Apprentice
  • 522
  • 2
  • 7
  • 19
3
votes
3 answers

java.lang.NoClassDefFoundError: org/apache/http/concurrent/FutureCallback

I am trying to use Unirest-Mashape to build java applications. This is my code: import com.mashape.unirest.http.*; public class PAskMe { public static void main(String args[]) throws Exception { HttpResponse response =…
dryairship
  • 6,022
  • 4
  • 28
  • 54
3
votes
1 answer

Twitter API error "Missing required parameter: grant_type" using Unirest.io

I am trying to obtain an API token from Twitter using Unirest.io PHP. My code is as follows: [in PHP] $response = Unirest::post("https://api.twitter.com//oauth2/token", array( "Authorization" => "Basic [AUTH_KEY]", "Content-Type" =>…
Nixlim
  • 31
  • 2
2
votes
1 answer

How to pass the multiple Query Parameters in url using unirest in the nodejs

In NodeJS using Unirest http library i am automating the Rest Apis. Currently i am stuck on how to pass the query parameters with rest url. i have tried following solutions but non is working: solution 1 unirest('GET',…
Asad
  • 49
  • 1
  • 3
  • 9
1 2
3
23 24