I need a library that is able to simulate a browser (in that it persists cookies and session id values as a browser would) while simultaneously giving me access to the JSON strings the server returns. I need it to ignore redirects and such as well.
Is there such a tool that would allow me to use node.js and Jasmine for testing a pseudo-RESTful api?
Note: I am migrating an ancient api written in Zend 1.8 to a new api that conforms more to RESTful practices, but in doing so, I must ensure that the new api is not so different from the old that it simply does not function.
You can use Postman, this is a chrome plugin.
Postman Chrome Plugin
If you do not need to deal with the GUI side of things, simple command line curl should work. It can use cookies, take text input via command line, return the results from the server as simple text.
You do say in your question test using node.js... not sure why you would feel that you 'have' to use that to test your api.
You can use Jmeter which is open source and has user friendly GUI. You do not need any special tools.
http://jmeter-plugins.org/wiki/RESTSampler/
Related
With the latest ForgeARKit-update-6-2018.1, I was trying to load my model in Unity, with the sample Unity scene 'loadAtStartup'. I can successfully load the sample models from 'Sandbox', but I couldn't load my model, which was uploaded through script 'test-2legged'.
Error message shows 504, it seems not reaching the service:
AsyncRequestCompleted The remote server returned an error: (504) Gateway Time-out.
UnityEngine.Debug:Log(Object)
Autodesk.Forge.ARKit.RequestQueueMgr:AsyncRequestCompleted(Object, AsyncCompletedEventArgs) (at Assets/Forge/CodeBase/RequestQueue.cs:322)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Model URN:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bWFvbGlua3ppOHM3cnlvZWx4bjVndnR4bjcyZWc2N2l0dGp0a2MvMmZsb29yX0FyYy5pZmM=
[Update 23/4/2019]
I found that I can successfully load the same model with ForgeARKit-update-3-2017.1.2f1. I compare the Forge code in Unity. I think it has something to do with the service URL. The version 6 is fetching models from 'https://developer-api-beta.autodesk.io' while version 3 is fetching from 'https://developer-api.autodesk.io'. Meanwhile the shell script 'test-2legged' is uploading to the latter one ('https://developer-api.autodesk.io'). That is why it counldn'd find the resource. Question here is how can I upload model to the 'beta' ARKit? I tried modifying the URL in script 'test-2legged' but it doesn't work. Below screen-shot is the output of script 'test-2legged' when fetching from 'beta' ARkit. It seems model is uploaded successfully, but some parsing post-work failed. I guess the response format is also changed in the beta version. Is there a beta version of 'test-2legged' scripts (and other Scene Preparation scripts)?
Please comments, Thanks.
This is correct. My apologizes for this, I know we did not documented very well on the server changes.
This update6 assumes you are using the new server under beta right now. The scripts and update 3 are using the legacy server. Note that the 2 servers are not necessarily compatible and store the data in different places, so make sure to always use the same server in Unity as the one you used to prepare the scene. When we will switch everyone to the new server, we will transfer the data from the legacy server to the new server cloud storage.
The Update3 package will still be able to read scenes from the new server, as we make sure the old Unity code stays compatible.
Note as well you need to use SafeBase64 encoded string everywhere. I saw in your description that you are using base64 encoded (not safe). The new server will be more strict of parameters and format, so I encourage you to test your scripts/code on the beta server.
Last, I am working on a new Unity code update, and documentation which will be released next week. Make sure to use this version - it adds support for 3legged, automatic 2/3legged token refresh, and more. If you got scenes failing, please contact me directly and share your models and URN. I'll either test it on my development environment, or look into our log files for the reason to fail. My email address is my first name at autodesk.com
Thank you Cyrille for your help!! I am replying you here as it's easier to insert images.
I replaced the function 'xbase64encode()' with 'xbase64safeencode()', and now it works! However it seems for some model it still responds some error and in that case it cannot be loaded in Unity. (as the image below). I checked the script and I think all the encoding are using SafeBase64. Any clue of that? Or is that caused by my model?
BTW, the loading performance is greatly improved than the legacy version!! It looks almost the same as the web client. Huge Thanks for that!
Good to know that there is going to be an update next week. Yes I will test it and get back to you later.
I am trying to send emails using smtp in an Adobe AIR application, I am unable to make the code work with gmail but it works with my hosted email without TLS/SSL so my assumption is that TLS/SSL is the issue.
I am using SMTPMAiller from http://www.bytearray.org/?p=27
with latest as3cryptolib I can fine.
I do not want to use a server side script.
Please respond only if you have a working code/application that works with gmail in present.
Thank you
Edit: My question is if you have already this working in present what libraries and what versions are you using, I am sure my libraries are too old.
I managed to send emails from gmail.yahoo using SMTP and SSL using this library airxmail
I had a few problems though, I was trying to log the code using event listeners to understand what is going wrong but adding a specific listener caused problems, I reported it here . For logging I suggest using what the author recommends(the mx.Log).
Other issue was caused by the not clear documentation from the first example I found, there was some code that needed to run for SSL only and other code that needed to run for TLS only.
I did not had time or need to test TLS so I am not sure if it works, code is not yet in production so maybe I will find more issues later.
I created a wrapper class, my needs is to have a test function when a user will add his email credentials and settings, then have the ability to send more then one email, I will show my main code here , use at your own risk.
I tried adding my sample here but SO code formatted did not like it, here is a gist I hope it will help.
Is there a way to check file size on the client (without the use of ActievX which also errors out), before it is passed back to the server? in asp
In ASP? No, by definition. Active Server Pages can't do anything before they get a request from the client.
There is a draft File API that will allow you to perform this sort of check using client side JavaScript. The Mozilla Developer Network has a guide on getting information about selected files. Once you have a reference to the file, you can just access its .size property.
Note that since the specification is a draft, it is rather new and subject to change. This one is very new and thus has [very limited browser support](http://caniuse.com/#search=file api).
You might also be able to achieve what you want using a Java applet or Flash (the latter of which would be better supported).
I have a WCF service set up to serve data through multiple endpoints (SOAP, JSON and XML) the SOAP and XML is working perfect, but when I try to view the json I get a prompt to download a file with the json results instead of displaying the results in the browser. This probably won't matter as the client will most likely be consuming the data from some sort of .net environment which will be able to handle the response natively, but I wanted to see if there was a way to display the json results in the browser just like the XML results.
An example of the url I am using to get the results:
http://localhost/api/Service.svc/json/GetResults?name=Test&test=test
This then prompts me to download a file named "GetReults" with no extension and the filetype is: application/json
If your goal is to view the content of the json response in the browser then change your settings in Firefox or else use another browser. I have tried a similar thing with IE and it showed the json content in the browser without making any changes. Not sure what Chrome will do.
I have a similar situation with a rest call that I post a request to. I was making a mock rest service in Grails and noticed that when I hit the live server or my mock server with Firefox it kept asking me to download the file, but not with IE. The problem I'm dealing with now is that I am trying to hit my mock endpoint with SoapUI and it is also asking me to download the file. If I hit the live server with SoapUI it does not ask me to download the file.
Still trying to figure this issue out.
This is exactly the desired behavior. The return response's content type is "application/json". Most browsers cannot display content with this content type inline (unless manually configured), so they prompt you to download the file.
If you actually save this file, and open it with -- say, note Notepad -- you will notice that the pure JSON response is contained in the file.
The inability to handle this content type and the browser forcing this download is almost never an issue, however. The reason is, the general use case for the usage of this JSON endpoint is either the ASP.NET AJAX framework-powered webpages (that automagically make these requests and parse responses by themselves), scripting environments like Python or Perl (which again would just get the requests and then parse them), or custom JavaScript frameworks.
Hope this helps!
I'm writing what is essentially a browser in Adobe AIR (ActionScript, not AJAX). A great bit of functionality to implement would be protocol handling. iTunes, for instance, handles itms protocols; when your friend sends you a link beginning with "itms://", it's going to launch iTunes as long as it's installed. Is there a way to write an AIR app (requiring AIR 2 would be fine) that can be the "handler" for a protocol in this way?
There is no way, programatically speaking, to specifically handle a particular protocol. However, there is InvokeEvent. InvokeEvent will be fired when the application is "invoked", either when it's explictly launched or if an associated file or URL is activated.
The process of associating your app with a particular file type or protocol scheme is separate and application-dependant. In iOS, for example, you would need to specify the protocol in Info.plist under CFBundleURLTypes/CFBundleURLSchemes.
Yes. You can use the URLLoader class to download data in binary form (URLLoader.BINARY) and then parse this as appropriate. See this CS3 documentation on working with external data.
http://www.patrick-heinzelmann.de/labs/lastfm/
I'm not sure exactly how it works and I don't see a way to download the app, so I can't even test it, but maybe it will help...
Check out this page. I am trying to find out the same thing, but I haven't found any solution to do it with just Air yet. Seems like you might need a custom installer to setup the correct registry entries, and a proxy application to "wash" the input to a correct format that then can start your application with the correct command line parameters. Hope this can be of any assistance.