GithubHelp home page GithubHelp logo

wycats / artifice Goto Github PK

View Code? Open in Web Editor NEW
214.0 214.0 15.0 15 KB

Replaces Net::HTTP with a subclass that routes all requests to a Rack application

Home Page: http://www.yehudakatz.com

License: MIT License

Ruby 100.00%

artifice's People

Contributors

indirect avatar paulj avatar segiddins avatar shawndrost avatar wycats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

artifice's Issues

Connecting outside artifice

I'm switching away from a modified fakeweb I built into my Web service stubbing gem: Fredo. It was easy to replace and for free I oet an extra spec passing that I didn't get around fixing. Thanks!

On the downside three specs that involve requests not resolved by the rack endpoint being forwarded to the web went red.

I was wondering if it would it be possible, if the endpoint passed to Artifice returns a 404 to have Artifice revert back to the usual Net::HTTP connection if instructed to do so? Like fakeweb does.

Chisel and Artifice Issue?

[00:37:33] [Client thread/WARN] [Artifice]: Couldn't load Chisel compat
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.ClassNotFoundException: info.jbcs.minecraft.chisel.ChiselBlocks
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.ClassLoader.loadClass(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.ClassLoader.loadClass(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Class.forName0(Native Method)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Class.forName(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at shukaro.artifice.compat.Chisel.load(Chisel.java:20)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at shukaro.artifice.ArtificeCore.init(ArtificeCore.java:113)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.post(EventBus.java:275)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.google.common.eventbus.EventBus.post(EventBus.java:275)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:541)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:867)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.client.main.Main.main(SourceFile:148)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.reflect.Method.invoke(Unknown Source)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:286)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:376)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at org.multimc.EntryPoint.listen(EntryPoint.java:165)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at org.multimc.EntryPoint.main(EntryPoint.java:54)
[00:37:33] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: Caused by: java.lang.NullPointerException

Support bodies specified on the request object

Not sure if paulj has submitted a pull request to you, but he has a fix worth merging: http://github.com/paulj/artifice/commit/6511e455b00792c663b054e541ba2a61a1a4ee88

If I create a Net::HTTP request like so:
request = Net::HTTP::Post.new(url.path, 'Accept' => 'application/json')
request.set_form_data(fields)
response = Net::HTTP.new(url.host).start { |http| http.request(request) }

The body set on the request (via set_form_data) is not used in your overridden request method.

This causes problems with HTTParty as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.