OpenSIPS 2.4.3 Rest Client module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenSIPS 2.4.3 Rest Client module

Ben Newlin

Hello,

 

After upgrading to 2.4.3 I have found that my tests using the REST client module are failing. It seems that some parameters to the rest_post client may have been inadvertently switched. Per the documentation [1], I am passing the body in the second parameter and the content type in the third.

 

async(rest_post("$var(uri)", "$json(resourceRequest)", "$var(send_ctype)", "$var(body)", "$var(recv_ctype)", "$var(rcode)"), resume);

 

But the request being sent out has the body and content type reversed:

 

{

  "method" : "POST",

  "path" : "/manager/v1/resources",

  "headers" : {

    "Host" : [ "203.0.113.6:1080" ],

    "Accept" : [ "*/*" ],

    "Content-Type" : [ "{ \"resources\": 1, \"capabilities\": [ \"sip-service\"" ],

    "Content-Length" : [ "17" ]

  },

  "keepAlive" : true,

  "secure" : false,

  "body" : "application\\/json"

}

 

I’ve verified that in 2.4.2 the request is being created properly.

 

[1] https://opensips.org/html/docs/modules/2.4.x/rest_client.html#afunc_rest_post

 

 

Ben Newlin


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: OpenSIPS 2.4.3 Rest Client module

Liviu Chircu

Hi Ben,

Looking into this asap.  I did lots of tests for the updated return codes / granular error handling, however I _did not_ assume I could have broken anything in that area.

Thanks,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 14.11.2018 17:04, Ben Newlin wrote:

Hello,

 

After upgrading to 2.4.3 I have found that my tests using the REST client module are failing. It seems that some parameters to the rest_post client may have been inadvertently switched. Per the documentation [1], I am passing the body in the second parameter and the content type in the third.

 

async(rest_post("$var(uri)", "$json(resourceRequest)", "$var(send_ctype)", "$var(body)", "$var(recv_ctype)", "$var(rcode)"), resume);

 

But the request being sent out has the body and content type reversed:

 

{

  "method" : "POST",

  "path" : "/manager/v1/resources",

  "headers" : {

    "Host" : [ "203.0.113.6:1080" ],

    "Accept" : [ "*/*" ],

    "Content-Type" : [ "{ \"resources\": 1, \"capabilities\": [ \"sip-service\"" ],

    "Content-Length" : [ "17" ]

  },

  "keepAlive" : true,

  "secure" : false,

  "body" : "application\\/json"

}

 

I’ve verified that in 2.4.2 the request is being created properly.

 

[1] https://opensips.org/html/docs/modules/2.4.x/rest_client.html#afunc_rest_post

 

 

Ben Newlin


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: OpenSIPS 2.4.3 Rest Client module

Liviu Chircu

Many thanks for catching this one, Ben, I just fixed it [1].  This bug breaks all async(rest_post()) and async(rest_put()) calls of the 2.4.3 original release.  Maybe we should do another one...

Cheers,

[1]: https://github.com/OpenSIPS/opensips/commit/fb2aaf65ed993f429b2f12b547dc872aa8632992

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 14.11.2018 17:53, Liviu Chircu wrote:

Hi Ben,

Looking into this asap.  I did lots of tests for the updated return codes / granular error handling, however I _did not_ assume I could have broken anything in that area.

Thanks,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 14.11.2018 17:04, Ben Newlin wrote:

Hello,

 

After upgrading to 2.4.3 I have found that my tests using the REST client module are failing. It seems that some parameters to the rest_post client may have been inadvertently switched. Per the documentation [1], I am passing the body in the second parameter and the content type in the third.

 

async(rest_post("$var(uri)", "$json(resourceRequest)", "$var(send_ctype)", "$var(body)", "$var(recv_ctype)", "$var(rcode)"), resume);

 

But the request being sent out has the body and content type reversed:

 

{

  "method" : "POST",

  "path" : "/manager/v1/resources",

  "headers" : {

    "Host" : [ "203.0.113.6:1080" ],

    "Accept" : [ "*/*" ],

    "Content-Type" : [ "{ \"resources\": 1, \"capabilities\": [ \"sip-service\"" ],

    "Content-Length" : [ "17" ]

  },

  "keepAlive" : true,

  "secure" : false,

  "body" : "application\\/json"

}

 

I’ve verified that in 2.4.2 the request is being created properly.

 

[1] https://opensips.org/html/docs/modules/2.4.x/rest_client.html#afunc_rest_post

 

 

Ben Newlin


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: OpenSIPS 2.4.3 Rest Client module

Ben Newlin

Liviu,

 

Thanks for the quick turnaround on this one! I’ve confirmed the fix in that commit.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Liviu Chircu <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Wednesday, November 14, 2018 at 11:10 AM
To: "[hidden email]" <[hidden email]>
Subject: Re: [OpenSIPS-Users] OpenSIPS 2.4.3 Rest Client module

 

Many thanks for catching this one, Ben, I just fixed it [1].  This bug breaks all async(rest_post()) and async(rest_put()) calls of the 2.4.3 original release.  Maybe we should do another one...

Cheers,

[1]: https://github.com/OpenSIPS/opensips/commit/fb2aaf65ed993f429b2f12b547dc872aa8632992

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 14.11.2018 17:53, Liviu Chircu wrote:

Hi Ben,

Looking into this asap.  I did lots of tests for the updated return codes / granular error handling, however I _did not_ assume I could have broken anything in that area.

Thanks,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 14.11.2018 17:04, Ben Newlin wrote:

Hello,

 

After upgrading to 2.4.3 I have found that my tests using the REST client module are failing. It seems that some parameters to the rest_post client may have been inadvertently switched. Per the documentation [1], I am passing the body in the second parameter and the content type in the third.

 

async(rest_post("$var(uri)", "$json(resourceRequest)", "$var(send_ctype)", "$var(body)", "$var(recv_ctype)", "$var(rcode)"), resume);

 

But the request being sent out has the body and content type reversed:

 

{

  "method" : "POST",

  "path" : "/manager/v1/resources",

  "headers" : {

    "Host" : [ "203.0.113.6:1080" ],

    "Accept" : [ "*/*" ],

    "Content-Type" : [ "{ \"resources\": 1, \"capabilities\": [ \"sip-service\"" ],

    "Content-Length" : [ "17" ]

  },

  "keepAlive" : true,

  "secure" : false,

  "body" : "application\\/json"

}

 

I’ve verified that in 2.4.2 the request is being created properly.

 

[1] https://opensips.org/html/docs/modules/2.4.x/rest_client.html#afunc_rest_post

 

 

Ben Newlin



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users