How to send get or post request to Httpbin with params in PATH? - httprequest

I set httpbin backend path is /get/{id},but response is 404

No method /get/{id} in httpbin,/cache/{value} is useful for me.

Related

How to query SFTP server with Karate via API?

The app that I am trying to test has an SFTP server that can be queried via API. Swagger shows the following sample cURL request to get domain files information, and I am having a hard time making this call with Karate:
curl -X GET -H 'Accept: application/json' 'https://{host}:{port}/api/{clientId}/'
I do the following where baseUrl is defined as https://sftp.mydomain.com:22 where 22 is the port number that I can successfully use to connect to the SFTP server via Cyberduck:
Feature:
Background:
* url baseUrl
* def moduleBase = '/api/12345/'
Scenario:
* path moduleBase
When method get
Then status 200
The error that I get is this:
ERROR com.intuit.karate - src/test/java/mytest.feature:9
When method get
http call failed after 815 milliseconds for url: https://sftp.mydomain.com:22/api/12345/
What am I doing wrong?
Clearly it may not be HTTP so I don't think Swagger and all is legit.
Maybe you can just delegate to the OS. Refer: https://stackoverflow.com/a/64352676/143475

Centreon web API v2 endpoints return 500 - No route found

I run centreon 21.04 in a VM for some tests.
I imported the Centreon REST API v2 collection into Postman as described here.
Some endpoints work like:
POST /login
GET /logout
GET /configuration/icons
GET /monitoring/acknowledgements
GET /platform/topology
but most other endpoints return an error 500 with "No route found".
Example of response with the /centreon/api/latest/monitoring/hosts endpoint:
$ curl --location --request GET 'http://<VM_IP>:80/centreon/api/latest/monitoring/hosts' --header 'X-AUTH-TOKEN: mytoken'
{"code":500,"message":"No route found for 'GET /monitoring/hosts'"}
The X-AUTH-TOKEN header is set with the token retrieved via the /login endpoint.
I'm using the default admin user for which I enabled Reach API Configuration and Reach API Realtime in the web UI via Configuration > Users > Contacts/Users > admin > Centreon Authentication.
Any idea why this is not working ?
So apparently some endpoints only work in the beta version of the API for now, so make sure you use the /centreon/api/beta/ path in the URL

Karate returns HTTP 415 for soap request

I'm trying to hit a SOAP service using karate and it always returns 415, whereas the same service is successful in SOAP UI.
Response in Karate:
20:05:37 20:05:37.236 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - response time in milliseconds: 37.15
20:05:37 1 < 415
20:05:37 1 < Content-Length: 0
Given url soapServiceURL
And header Content-Type = 'application/xml'
And request requestPayLoad
When method post
Then status 200
Kindly advise if I'm missing something here
Please read the docs and use soap action if needed: https://github.com/intuit/karate#soap-action
Karate can make any HTTP request, but you need to figure out the right headers etc. One hint is export to cURL and then you will be able to do it easily.

soapaction header is not passing through

I have a very simple definition in traefik.toml file. The backend is a service that echoes back the header passed through.
[frontends]
[frontends.test]
entryPoints = ["http"]
backend = "test"
passHostHeader = true
[frontends.test.routes]
[frontends.test.routes.route0]
rule = "Host:localhost;PathPrefixStrip:/test"
[backends]
[backends.test]
[backends.test.servers]
[backends.test.servers.server0]
url = "http://localhost:8000"
weight = 1
I can pass any http header from the client to the backend and it is echoed back as implemented in the backend service. However I cannot pass soapaction header. Traefik does not return any response till it times out. Nothing in the log that indicates an issue.
Any help will be much appreciated
This may be due to the fact that Traefik rewrites headers canonically as they should be case-insensitive (see https://github.com/containous/traefik/issues/466).
Could you check that on your backend server ?

CORS request not valid - missing headers?

I am trying to upload an image to a finagle (netty) server. For the OPTIONS request I return the following:
curl -X OPTIONS http://localhost:8686/images -i
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST
Browser (FireBug): http://s15.postimg.org/vtdzyfshn/Screen_Shot_2014_09_02_at_9_49_05_PM.png
The following POST request fails with
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote
resource at http://localhost:8686/images. This can be fixed by moving the resource
to the same domain or enabling CORS.
FireBug 1 (Console): http://s30.postimg.org/9utq4ridt/Screen_Shot_2014_09_02_at_9_53_41_PM.png
FireBug 2 (Net Tab): http://s16.postimg.org/jyblxfcv9/Screen_Shot_2014_09_02_at_9_54_37_PM.png
FireBug 3 (Net Tab - POST): http://s14.postimg.org/e8czua2wh/Screen_Shot_2014_09_02_at_9_54_47_PM.png
Any idea what I am missing?
(I am using this upload script: http://www.extremecss.com/creating-asynchronous-file-upload-system-using-html5-file-api/
You have to return the CORS headers (Access-Control-Allow-Origin: *) within the response header to your POST as well, instead of just within the OPTIONS response.