Switch default http error messages from HTML to plaintext in Adonis - adonis.js

By default, Adonis generates "nicely formatted" error responses. Problem is, they often generate more pain than they help. It turns hard to read responses in the console or tools like Postman. How can I configure so that Adonis always responds in plaintext in case of an exception?

Run this command in AdonisJS project directory
adonis make:ehandler
File app\Exceptions\Handler.js will be created. Now you will get simple errors.

In your global error handler, you can set the headers to plain text like this:
response.header('Content-type', 'text/plain')

Related

How to resolve 400 Bad Request error in Postman in a sample MEAN application

I am working on a sample MEAN application where in I have started to create the node.js related files and connected the same to MongoDB. I have create a POST call which sends the json to the DB. I tried to test the api using postman but not sure whats wrong, I have checked multiple times, the api throws bad request.Any help on this is much appreciated. Thanks.
Added the relevant route.js, app.js and contact.js files for reference in stackblitz link. Added error in postman for reference.
https://stackblitz.com/edit/node-mlodls?file=app.js
Resolved the issue using postman extension. Wondering why the API doesnt work in postman software and works in postman extension

PermissionError using testrunner of soapui through RobotFramework

I'm currently working on web services test automation, to do it, I'm calling SoapUI testrunner.bat from robotframework to send a request using run process keyword. The command used:
run process "AbsolutePath/testrunner.bat" -e"enpointURL" -t"aboslutePath/soap-projectSettings.xml" -s"testsuitename" -c"testcasename" -r"aboslutePath/soap-project.xml"
The command, used in a cmd without admin permissions is working fine and making the request. If it's used from robot returns a PermissionError: [WinError 5] Acces is denied.
I've already checked the permissions of the SoapUI root folder (where testrunner.bat is) and the SoapUI project. All of them are "Full control" for my user.
Also, I've checked if there is any way to run process with admin permissions but nothing.
I'm not understanding something or missing something and I'm stucked.
Thanks in advance, best regards!
okay, my fault.
I should use a tab instead a simple space
run process "AbsolutePath/testrunner.bat" -e"enpointURL" -t"aboslutePath/soap-projectSettings.xml" -s"testsuitename" -c"testcasename" -r"aboslutePath/soap-project.xml"
each argument of the command is also an argument in robot. I thought that all the command was an argument.

Giving value to parameter from a file to send it through HTTPPOst

I have been struggling with Jenkins lately, and I'm stuck because I wanna send some parameters through HTTP Post, and I know how to do it, but the thing is that I am saving a Http request response to a file in my workspace, and then I want to use that file, read it and send the text I saved previously to a new HTTP Request, does anyone have any idea how can I achieve this?
Thanks in advance!!!
Install copy artifacts from another project plugin ( copy artifacts) add in build steps store the file in your workspace then you can run a shell script to read the desired content from that file .
if curl would work, that would be a simple way to send a file's contents as your POST body. see this answer.
Jenkins can work with Jmeter and Jmeter is great tool for handling request and response see tutorial

Web service Response got a schema validation error

I'm using glassfish for my development.
When I hit a web service by sending a SOAP request through SoapUI in our UAT box. I got the following schema validation error message.
Invalid QName value: Can't resolve prefix 'ns0'
The response looks like following for the line causing the error.
<faultcode>ns0:SC_018</faultcode>
But in my local box. I don't get the validation error. Because the line causing problem above looks like
<faultcode xmlns:ns0="http://****.com">ns0:SC_018</faultcode>
I'm thinking there should be some JVM options set up are different that may cause this error ?
There is a namespace prefix ns0 (in your XML request/response) that is not defined.
Because you say the line appears at one machine with the proper namespace definition (xmlns:ns0="http://****.com") and not at the other, this can be a problem at the service provider.
ns0:SC_018 looks like a custom fault code that sometimes is built right (with namespace and no error given) and sometimes isn't (no namespace and error appears).
You say this appears in one machine and not at other, is it the same client? SoapUI is a Java program, so it must behave almost exactly at different environments. Also, this is such a specific issue that seems very unlikely this is a JVM configuration problem.
In order to resolve this issue, you have update the schema, once schema is updated successfully, then try to update the definition. It would be fixed.

How can I make hoptoad in Django 1.2 log errors to log file as well as send airbrake notifications?

We're using django 1.2.7 and the hoptoad logging middleware (hoptoad.middleware.HoptoadNotifierMiddleware).
When an error occurs, the error message gets sent to airbrake, but it does not seem to get logged to the django log file. It seems like it's intercepted by hoptoad exclusively.
Does anyone know how to also get the errors logged to the local django log file on disk? I couldn't find any such option in the hoptoad documentation.
Is there a custom modification needed to the hoptoad middleware class?