Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Code and Post method #3

Open
Aximem opened this issue Aug 12, 2016 · 5 comments
Open

Source Code and Post method #3

Aximem opened this issue Aug 12, 2016 · 5 comments

Comments

@Aximem
Copy link

Aximem commented Aug 12, 2016

Hi,

Thanks for your contribution.

Firstly, we don't have any access to your code or you have deleted it ? I can't see any source code when I fork your project.

Secondly, I think there is a bug in your project (that's why I wanted to fork it). In case of POST Method, if you had values in "body" (.withBody("{name:popapp ,age:27}")), this is not working ! The request doesn't have the body params.

TY

@studioidan
Copy link
Owner

thank you.
i will check this ASAP!

how did find out there is no body in the request?
can i see your full code?

about deletation, i dont know what do you meen,
the project is rigt here
https://github.com/studioidan/HttpAgent

Sent with MailTrack
https://mailtrack.io/install?source=signature&lang=en&referral=studioidan@gmail.com&idSignature=22

2016-08-12 16:24 GMT+03:00 Maxime Charruel notifications@github.com:

Hi,

Thanks for your contribution.

Firstly, we don't have any access to your code or you have deleted it ? I
can't see any source code when I fork your project.

Secondly, I think there is a bug in your project (that's why I wanted to
fork it). In case of POST Method, if you had values in "body"
(.withBody("{name:popapp ,age:27}")), this is not working ! The request
doesn't have the body params.

TY


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#3, or mute the thread
https://github.com/notifications/unsubscribe-auth/AEugVvepvejaVrwKQsCmlkd3HA0Fw0Ehks5qfHP-gaJpZM4JjFF3
.

פיתוח אפליקציות אנדרואיד - 0524667179

@Aximem
Copy link
Author

Aximem commented Aug 12, 2016

You deleted all your source code in previous commit ...
83a0987

HttpAgent.post(baseAPIUrl + "xxx.json").headers("Authorization", tokenApp, "Content-Type","application/json", "Accept", "application/json").withBody("{email:" + email + ",password:" + password + ",salt:" + salt + "}").goJson(new JsonCallback() {@Override protected void onDone(boolean success, JSONObject jsonObject) {}});

@Aximem
Copy link
Author

Aximem commented Aug 22, 2016

Back from vacation, in fact this is my bad, I didn't check the API I was requesting, it required JSON Post parameters, so I get your code and updated a little to manage this case :

public HttpAgent withBody(String... bodies) { if (bodies.length % 2 != 0) { mErrorMessage += "\nbodies must be even number"; Log.e(TAG, "bodies must be even number"); return this; } for (int i = 0; i < bodies.length; i += 2) { mBodies.put(bodies[i], bodies[i + 1]); } this.mHasBody = !U.isEmpty(bodies); return this; }
if (mHasBody) { JSONObject jsonParam = new JSONObject(); for (Map.Entry<String, String> entry : mBodies.entrySet()) { jsonParam.put(entry.getKey(), entry.getValue()); } DataOutputStream printout; printout = new DataOutputStream(mConnection.getOutputStream ()); String str = jsonParam.toString(); byte[] data=str.getBytes("UTF-8"); printout.write(data); printout.flush (); printout.close (); }

HttpAgent.post(baseAPIUrl + "clients.json") .headers("Authorization", tokenApp, "Content-Type", "application/json", "Accept", "application/json") .withBody("email", email, "password", password, "salt", salt)

Maybe you can upgrade your repo to manage this JSON case. Anyway Thanks for the feedback.
You should upgrade your repo anyway, there is not the source in last commit !

@studioidan
Copy link
Owner

tnx! i'll add this functionallity! is your api server is microsoft web api?

Sent with MailTrack
https://mailtrack.io/install?source=signature&lang=en&referral=studioidan@gmail.com&idSignature=22

2016-08-22 13:03 GMT+03:00 Maxime Charruel notifications@github.com:

Back from vacation, in fact this is my bad, I didn't check the API I was
requesting, it required JSON Post parameters, so I get your code and
updated a little to manage this case :

`public HttpAgent withBody(String... bodies) {
if (bodies.length % 2 != 0) {
mErrorMessage += "\nbodies must be even number";
Log.e(TAG, "bodies must be even number");
return this;
}
for (int i = 0; i < bodies.length; i += 2) {
mBodies.put(bodies[i], bodies[i + 1]);
}

this.mHasBody = !U.isEmpty(bodies);
return this;

}`

`if (mHasBody) {
JSONObject jsonParam = new JSONObject();

        for (Map.Entry<String, String> entry : mBodies.entrySet()) {
            jsonParam.put(entry.getKey(), entry.getValue());
        }

        DataOutputStream printout;
        printout = new DataOutputStream(mConnection.getOutputStream ());

        String str = jsonParam.toString();
        byte[] data=str.getBytes("UTF-8");
        printout.write(data);

        printout.flush ();
        printout.close ();
    }`

HttpAgent.post(baseAPIUrl + "clients.json")
.headers("Authorization", tokenApp, "Content-Type", "application/json",
"Accept", "application/json")
.withBody("email", email, "password", password, "salt", salt)

Maybe you can upgrade your repo to manage this JSON case. Anyway Thanks
for the feedback.
You should upgrade your repo anyway, there is not the source in last
commit !


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEugVq8rgEI7WVnq629FrGXNEEQl4a9aks5qiXQMgaJpZM4JjFF3
.

פיתוח אפליקציות אנדרואיד - 0524667179

@Aximem
Copy link
Author

Aximem commented Aug 22, 2016

No, this is just a Symfony project with FOSRestBundle, we created an API with some methods. We could have use html params but we used JSON (dunno why ;))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants