I wanted to use Diffy for my API testing but found that it does not allow customization of headers while sending requests. Our Apis need access tokens which are different in different servers that are passed as HTTP Headers.
I started exploring the Diffy code and tried to resolve this issue (for me) myself.
Understanding the flow/code is a bit difficult for me as I have no experience in scala. However I understood the code a little and tried to add a line of code at
[HttpDifferenceProxy.scala] (https://github.com/twitter/diffy/blob/master/src/main/scala/com/twitter/diffy/proxy/HttpDifferenceProxy.scala)
The Diffy tool executes a Http Request asynchronously after checking whether it is allowed to do so. I added my line of code here before this check to add a header.
object SimpleHttpDifferenceProxy {
lazy val httpSideEffectsFilter =
Filter.mk[HttpRequest, HttpResponse, HttpRequest, HttpResponse] { (req, svc) =>
req.headers().add("Authorization1", "123") //My code here
val hasSideEffects =
Set(Method.Post, Method.Put, Method.Delete).contains(Request(req).method)
if (hasSideEffects)
DifferenceProxy.NoResponseExceptionFuture else svc(req)
} }
Okay I am facing two problems.
The header is not getting added
Any suggestion for a good Scala IDE -- I am using ScalaIDE built on top of Eclipse but the debugging is nowhere close to debugging capabilities of Eclipse in java.
What am I doing wrong here?
Thanks,
Sukalpo.
I found the answers to both my questions and they are the same :)
IntelliJ is the most coolest IDE ever.
Answer for 1:- The headers were getting added. The shitty ScalaIDE that I was using somehow did not show it while I was debugging and wasted my whole day
Answer for 2:- Hands down IntelliJ
Related
I met some strange behavior, which got my mind blow out.
I have a piece of code
import 'package:dio/dio.dart';
...
var baseOptions = BaseOptions(
baseUrl: "http://localhost:8080");
If I run it from simple Dart console program I got this in debugger which at final works OK:
However when I do THE SAME THING somewhere inside Flutter stuff, I get this weird thing which doesn't work:
What's going on here? What am I doing wrong in the Flutter case?
I finally found the answer. I was wrong with my assumptions in this question, but I will not delete it for people who would have the same root cause analysis path as me.
First of all my problem was not weirdness in BaseOptions. The actual error I got from Dio was just string: "XMLHttpRequest error". I started to find anything strange and found divergence in BaseOptions which led me to idea that the problem was the weird BaseOptions. Not it's not. The real root cause was with CORS. Since my build used web based Flutter and an app was opened in Chrome the CORS defense system started to work and prevented the requests from sending. In console Dart app everything was ok since there is no CORS involved. One more problem was that I used POST request type and a custom header, which both are also not very welcome for CORS policies.
So to fix my problem what I had to do - is to fix CORS.
But what is going on with BaseOptions? I don't know for sure but most likely it is related to the way how Dart code compiled to JS. Looks a bit ugly in debugger, but it seems JS needs to know which field comes from which place for some reason.
I get SOAP_EMPTY using gsoap, I have searched for a long time and had no answer,SOAP_EMPTY is newly added to gsoap,and it seems I'm the unlucky guy to meet this problem.
Here is where my code come from:https://github.com/miibotree/ONVIF/blob/master/main.c
Now soap_call___tds__GetCapabilities will return code SOAP_EMPTY,I'm now using gdb to track this problem it seems that I need to set a valid soap->id to avoid this problem,but I'm a fresh guy with onvif and don't know how to set a valid soap->id,and now I'm reading various docs about onvif and trying to solve it.
Hope any guys could help me, sinch searching so many docs makes my eyes pain and I still haven't found the answer,thanks.
SOAP_EMPTY is a validation failure. This error indicates than an element/attribute is empty but is supposed to have content. For example an integer value should not be an empty string. The old error generated by older gSOAP releases in this case was SOAP_TYPE which was less informative. In either case, validation fails. The best way to find out is to use soap_print_fault() and soap_print_fault_location()` where the latter call shows the location in XML where the problem is. Our ONVIF testing with gSOAP did not reveal such an issue.
Recently we moved to JMeter 3.0 and we are receiving the following error, though the same JMX works on previous JMeter 2.13 version
PUT Data:
<actual file content not shown here>
Implementation used: Default(HTTPClient 4.5.4) and Also tried with HttpClient3.1 and recieved same error.
Any chance to know what could have went wrong.
You're not receiving an error , it's a new behaviour.
To allow sending big files along PUT, jmeter has been modified to buffer data and not store it in SampleResult making it possible to sendbig files.
I had same issue...thought jmeter was doing something wrong since this stuff worked for me in 2.13...hasn't worked since version 3. well..saw a post somewhere that said, using the JAVA implementation of HTTP worked. Guess what? it did work for me too!!! I've been struggling trying to dissect every part of the POST. I was doing it right all along, just needed JAVA implementation of HTTP and voila!
hope that helps!
I had the same problem.This is the issue with meter 3.0. Downloading the latest version of Jmeter 3.3 solved the problem.
I just wrote my first nodejs program using the node-mongodb-native driver. I used the documentation code from the github page, i.e.:
var mongodb = require("mongodb"),
mongoserver = new mongodb.Server('localhost', 6574),
dbConnector = new mongodb.Db('test', mongoserver);
dbConnector.open(function(err, db){
if(err)
console.log('oh shit! connector.open error!');
else{
...
However, upon looking at some example code on the github page, I discovered that the set up code looks very different from what I used. Does anybody know if there's any real difference between the different methods? I'm completely new to all this stuff and can't really tell if there's any reason to use one over the other. The code I wrote seems to run fine, but if the creator of the driver is using different code, I figured it would be worth checking if there are any reasons for that.
Thanks in advance for any replies!
Sami
Hi I'm the creator and no there is no particular reason you can't use your style. As when it comes to docs I usually tell people to start with the integration tests as there are many examples on how to do stuff. Unfortunately due to having a fulltime job the docs are not kept up to date at the pace I would like to.
I'm hoping to do something with that come late september but right now I'm trying to just get the driver up to the expected features of mongodb including making it work with 1.9.X and higher.
I'll accept any docs pull requests happily as the more the community help me the more it helps itself :)
I need to use ZendAMF on a symfony project and I'm currently working on integrating the two.
I have a frontend app with two modules, one of which is 'gateway' - the AMF gateway. In my frontend app config, I have the following in the configure function:
// load symfony autoloading first
parent::initialize();
// Integrate Zend Framework
require_once('[MY PATH TO ZEND]\Loader.php');
spl_autoload_register(array('Zend_Loader', 'autoload'));
The executeIndex function my the gateway actions.class.php looks like this
// No Layout
$this->setLayout(false);
// Set MIME Type
$this->getResponse()->setContentType('application/x-amf; charset='.sfConfig::get('sf_charset'));
// Disable cause this is a non-html page
sfConfig::set('sf_web_debug', false);
// Create AMF Server
$server = new Zend_Amf_Server();
$server->setClass('MYCLASS');
echo $server->handle();
return sfView::NONE;
Now when I try to visit the url for the gateway module, or even the other module which was working perfectly fine until this attempt, I only see a blank screen, with not even the symfony dev bar loaded. Oddly enough, my symfony logs are not being updated as well, which suggests that Synfony is not even being 'reached'.
So presumably the error has something to do with Zend, but I have no idea how to figure out what the error could be. One thing I do know for sure is that this is not a file path error, because if I change the path in the following line (a part of frontendConfiguration as shown above), I get a Zend_Amf_Server not found error. So the path must be correct. Also if I comment out this very same line, the second module resumes to normality, and my gateway broadcasts a blank x-amf stream.
spl_autoload_register(array('Zend_Loader', 'autoload'));
Does anyone have any tips on how I could attach this problem?
Thanks
P.S. I'm currently running an older version of Zend, which is why I am using Zend_Loader instead of Zend_autoLoader (I think). But I've tried switching to the new lib, but the error still remains. So it's not a version problem as well.
got it...
I was not using
set_include_path()
while loading Zend. It's still odd that it would give such a cryptic error, but this was the missing piece indeed.