Giter VIP home page Giter VIP logo

servant-jsonrpc's Introduction

servant-jsonrpc

This module extends servant to make it easy to define JSON-RPC servers and clients.

Notes

  • Does not enforce the jsonrpc key in the response
  • Does not enforce id key on error responses
  • We allow for server messages with null for both error and result keys
  • The client interface hides the id key since the semantics of HTTP determine which server responses correspond to which client requests.

Examples

See the package ./servant-jsonrpc-example for client, server, and API definition examples.

servant-jsonrpc's People

Contributors

gambolingpangolin avatar verifiedtm avatar zzantares avatar ukari avatar

Stargazers

Shawn Zhang avatar Théophile Choutri avatar hussein-aitlahcen avatar EvanPiro avatar Kayvan  ≅ کیوان avatar  avatar Sergey B avatar Matthew Wraith avatar Michael Dunn avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

servant-jsonrpc's Issues

Use application/json as request body MIME type

As of version 1.1.1 the library sends application/json-rpc as the request body MIME type, but it seems some/most servers still want application/json. Here is a typical request and response:

(Request {requestPath = (BaseUrl {baseUrlScheme = Http, baseUrlHost = "216.158.66.219", baseUrlPort = 8899, baseUrlPath = ""},""), requestQueryString = fromList [], requestBody = Just ((),application/json-rpc), requestAccept = fromList [application/json-rpc,application/json], requestHeaders = fromList [], requestHttpVersion = HTTP/1.1, requestMethod = "POST"}) (Response {responseStatusCode = Status {statusCode = 415, statusMessage = "Unsupported Media Type"}, responseHeaders = fromList [("Server","nginx"),("Date","Sat, 29 Oct 2022 05:44:10 GMT"),("Content-Type","text/plain; charset=utf-8"),("Content-Length","81"),("Connection","keep-alive")], responseHttpVersion = HTTP/1.1, responseBody = "Supplied content type is not allowed. Content-Type: application/json is required\n"}

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.