batch_api | A Facebook-style , RESTful Batch API | REST library
kandi X-RAY | batch_api Summary
kandi X-RAY | batch_api Summary
A Facebook-style, RESTful Batch API
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of batch_api
batch_api Key Features
batch_api Examples and Code Snippets
Community Discussions
Trending Discussions on batch_api
QUESTION
I maintain a mature codebase that uses Rails as an API. The Rails app also does some things with MQTT, a realtime, non-web, non-HTTP protocol.
Some users have requested the ability to simulate the same REST commands over the MQTT protocol (avoids the need to auth twice and have two different protocol clients).
I have seen some projects, such as Facebook's API "simulate" HTTP by putting parts of the HTTP request into a request using JSON (eg: have a "header" and "method" property on a JSON payload). This is precisely what I want to do but outside of the HTTP context entirely. It will occur in a background worker that handles MQTT messages.
Is it possible to use ActionDispatch and friends to simulate a controller dispatch in isolation?
I'm having a hard time finding documentation on how to instantiate an ActionDispatch::Request
object in isolation outside of RSpec.
ANSWER
Answered 2018-Jun-12 at 12:55Ow very interesting problem!
My first idea was to approach it backwards: so create a fake Rack::Request
or ActionDispatch::Request
and then force it to be handled? Assuming it would go to the right controller and action automatically (so you do not have to call it explicitly). But of course the problem remains: how to create the Request
:)
So I was browsing the rails tests and I found the following snippet which might get you started:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install batch_api
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page