Giter Site home page Giter Site logo

easynetwork's People

Contributors

jaksab avatar killvetrov avatar tvpsoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easynetwork's Issues

Handle redirect

It is necessary to provide redirects handling:

  • Add redirect callback
  • Go to redirect URL automatically
  • Change log messages

Numeric request parameters serialized to JSON as strings

When using Request.setContentType(NConst.MIME_TYPE_JSON) all parameters added via addParam are serialized as strings:

{"projectId":"471","text":"","status":"pending approval","fileId":"7230"}

In some cases there is a requirement for numeric type in JSON (fileId in this example):

{"projectId":"471","text":"","status":"pending approval","fileId":7230}

In current version 1.4.2 there is no way to serialize parameter as a number.

Retry a request after it fails

Hi
What i'm seeking is to override addOnErrorDefaultListener and resend the request with all its parameters after it fails (cause of bad network for example)
Is there a way to do it without having to catch these events on every requests of every activity ?

Url encoding for query parameters is incorrect in version 1.2.6 and up

Проблемный коммит: b3f122e

Поведение в предыдущих версиях:
[Query params]: q=Luke+Bryan++Brett+Eldredge+%26+Granger+Smith+Klipsch+Music+Center; imageType=photo; mkt=en-us; offset=0; count=4

Поведение в версии 1.2.6 и выше:
[Query params]: q=Dallas Cowboys vs. Green Bay Packers AT; T Stadium; imageType=photo; mkt=en-us; offset=0; count=4

Access background thread

Is there a way to write codes in the doInBackground method of the Asynctask ?
All the overrided methods happens on the main UI thread.
What I want is sleep the backgruond thread for atleast 1 sec so that the progress dialog doesn't show and hide too quickly
Thanks

PUT request fails to complete with content type and body

Running the following request fails in version 1.4.1.

EasyNet.put()
    .setUrl(destinationUrl)
    .setContentType("image/png")
    .addParam(imageFile);

Log output:

I/EasyNetwork: [PUT] https://storage.googleapis.com/...
I/EasyNetwork: [Headers]: User-Agent=App-Android/1.0-dev Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075); Content-Type=image/png;
I/EasyNetwork: [Error]: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

Sending nested JSON

So far the only way i found to send a json is to add parameters one by one
The method .setBody(body) doesn't seem to do anything.
If I want to send a post or a put with nested json ,say i have this class

User {
int userId;
String userName;
City city;
}
City {
int cityId;
String cityName;
}

And my REST controller expect a JSON of type :
{
"userId": 1,
"name": "Name",
"city": {
"cityId": 1,
"cityName": "City1"
}
}

How can I post/put this in the body ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.