Docusign Connect API : Not receiving request parameters in Rails 4 app - ruby-on-rails-4

I have a docusign account, where I am creating an envelope of multiple/single documents and trying to send them through "Connect" to a particular endpoint/url after signing of the documents is done.
Now I have two applications for the endpoint url.
The first application is a Rails 2.3.1 app in which I get all the params including byte streams of the files sent through docusign.
This works fine.
The second application is a Rails 4.2.2 with ruby 2.2.2 . Now in this application, when I receive the request from the docusign, the request does not contain any params.
Can any one tell why there is difference in the behavior between Rails 2.3.1 and Rails 4.2.2.
Please Note in both the cases , the request is a POST request.
Update:
We have deployed a sample Rails 4 app on Heroku. Below is the link:
https://aqueous-harbor-4271.herokuapp.com/docusign/consume
which can be used to test a POST request that docusign sends through connect api. Just set up the connection endpoint as the above URL.
It just renders the incoming request parameters in json as response.

Vipul said, "The issue has been fixed. It was related to Rails 4 stack where in it truncates the request parameters if the request method is POST and content type is application/xml. No issue with docusign."
I'm putting the answer here so this doesn't show up as an unanswered question when searching Stack Overflow.

Related

Postman cookies not set for subdomain (Postman Inceptor, Postman Native App)

i am playing around with Postman to get some insight on how things work behind the curtain and ran into, what I believe, is an issue but wanted to ask before I create a new issue on GitHub.
I am intercepting the request from my browser to the same site using the Postman Interceptor to use the request values in the native app. I have cookies enabled and the site (the whole domain) whitelisted.
When I use the history to resend the same request that was captured I get an auth error that is caused by the fact that the cookies are not included in the request (found that out by checking the cURL code snippet). I believe the reason for that is, that the cookies are set under another sub domain than that the request is send to.
I will try to include some pictures to clarify. My question here is:
Am I missing something/did I set something up in the wrong way
or is this an issue and I should create an issue in the official Postman Github page
cURL request
Cookies in Postman Native App
you should see if cookie is being send not using code snippet but the console :
its indeed sending cookies ,

Can I see the responses to requests when capturing requests with Postman?

I have the proxy supported by Postman running. I'm using this to capture requests from integration tests.
I can see the requests in the history tab, but request details do not include response data, such as http code, response body etc.
If I click send, i.e. repeat the request with Postman, then this data is displayed.
I'm really confused here, since Postman is the proxy and is able to capture the request and response both, why on earth it won't bother displaying the response data, and only display details of the request?
How do I display the response to captured requests from another process??
To provide further details: I'm using the proxy, not the interceptor because I'm making calls to localhost and interceptor won't capture those.
Here is what the UI looks like, with the giant question mark showing the empty response section :)
The entries in the history tab are generated by integration tests making calls to a development server running on localhost.
If I repeat the particular (currently selected) request by clicking the send button, it'll display the json response happily.
Postman is the latest version (as of the date and time of this post) running under WSL2 with Ubuntu 20.04
Since version 8.9, Postman now allows you to capture responses along with requests.

nginx API cross origin calls not working only from some browsers

TLDR: React app's API calls are returning with status code 200 but without body in response, happens only when accessing the web app from some browsers.
I have a React + Django application deployed using nginx and uwsgi on a single centOS7 VM.
The React app is served by nginx on the domain, and when users log in on the javascript app, REST API requests are made to the same nginx on a sub domain (ie: backend.mydomain.com), for things like validate token and fetch data.
This works on all recent version of Firefox, Chrome, Safari, and Edge. However, some users have complained that they could not log in from their work network. They can visit the site, so obviously the javascript application is served to them, but when they log in, all of the requests come back with status 200, except the response has an empty body. (and the log in requires few pieces of information to be sent back with the log in response to work).
For example, when I log in from where I am, I would get response with status=200, and a json object with few parameters in the body of the response.
But when one of the users showed me the same from their browser, they get Status=200 back, but the Response is empty. They are using the same version of browsers as I have. They tried both Firefox and Chrome with the same behaviours.
After finally getting hold of one of the user to send me some screenshots. I found the problem. In my browser that works with the site, the API calls to the backend had Referrer Policy set to strict-origin-when-cross-origin in the Headers. However on their browser, the same was showing up as no-referrer-when-downgrade.
I had not explicitly set the referrer policy so the browsers were using each of their default values, and it differed between different versions of browsers (https://developers.google.com/web/updates/2020/07/referrer-policy-new-chrome-default)
To fix this, I added add_header 'Referrer-Policy' 'strict-origin-when-cross-origin'; to the nginx.conf file and restarted the server. More details here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
The users who had trouble before can now access the site API resources after clearing cache in their browsers.

Ember / Ember Data - Error: The adapter operation was aborted after 201 created

Ember 3.0.0
Ember Data 3.0.2
Ruby on Rails 5.2.0
When using Ember and Ember Data to create a new record on a backend server using the default adapter (JSON_API) I get the following weird scenario:
The data is posted correctly to the backend and the backend replies with a 201 Created reply along with the new record rendered as JSON_API. I have used cUrl to simulate a POST to the backend and the reply is correct. However the adapter still rejects the operation.
When storing the record I use:
newAccount.save().then(allIsOk).catch(failure);
Even though the record is saved correctly and the backend server replies with a 201 Created the allIsOk is never called - only the .catch(failure) is triggered.
I have tried to change the reply from the backend server to 204 No content but the problem persists.
The CORS config for the backend server is as follows:
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
methods: %i[get post put patch delete options head]
end
end
We have developed a lot of apps in the past using the 2.x branch of Ember without any problems. I am really not sure where the error could be. The backend seems to be working correctly returning the correct data so I assume that the problem is with Ember / Ember Data or just me missing a tiny detail somewhere.
The only related topics I can find are these:
POST request to API from Ember often fails with 'The adapter operation was aborted Error'
https://github.com/cyu/rack-cors/issues/106
Found the solution to the problem. Please see here for info:
https://github.com/emberjs/data/issues/5440

Connecting a desktop application with a website

I made an application using Qt/C++ that reads some values every 5-7 seconds and sends them to a website.
My approach is very simple. I am just reading the values i want to send and then i make an HTTP POST to the website. I also send the username and password to the website.
The problem is that i cannot find out if the request is successful. I mean that if i send the request and server gets it, i will get an HTTP:200 always. For example if the password is not correct, there is no way to know it. It is the way HTTP works.
Now i think i will need some kind of a protocol to take care the communication between the application and the website.
The question is what protocol to use?
If the action performed completes before the response header is sent you have the option of adding a custom status to it. If your website is built on PHP you can call header() to add the custom status of the operation.
header('XAppRequest-Status: complete');
if you can modify the server side script you could do the following
on one end :
You can make the HTTP post request via ajax
and evaluate the result of the ajax request.
On the serve side
On the HTTP request you do your process and if everything goes accordingly you can send data back to the ajax script that called it.
solves your problem .. ?