All Projects → Zaid-Ajaj → Fable.simplehttp

Zaid-Ajaj / Fable.simplehttp

Licence: mit
Http with Fable, made simple.

Programming Languages

fsharp
127 projects

Projects that are alternatives of or similar to Fable.simplehttp

Wretch
A tiny wrapper built around fetch with an intuitive syntax. 🍬
Stars: ✭ 2,285 (+3908.77%)
Mutual labels:  ajax, request
Wretch Middlewares
Collection of middlewares for the Wretch library. 🎁
Stars: ✭ 42 (-26.32%)
Mutual labels:  ajax, request
vue-methods-promise
Let Vue methods support return Promise
Stars: ✭ 35 (-38.6%)
Mutual labels:  ajax, request
Vue Api Request
Control your API calls by using an amazing component which supports axios and vue-resource
Stars: ✭ 116 (+103.51%)
Mutual labels:  ajax, request
Fable.remoting
Type-safe communication layer (RPC-style) for F# featuring Fable and .NET Apps
Stars: ✭ 175 (+207.02%)
Mutual labels:  fable, ajax
AjaxHandler
ASimple PHP Class to help handling Ajax Requests easily
Stars: ✭ 30 (-47.37%)
Mutual labels:  ajax, request
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (-21.05%)
Mutual labels:  ajax, request
Render async
render_async lets you include pages asynchronously with AJAX
Stars: ✭ 974 (+1608.77%)
Mutual labels:  ajax
Feliz.materialui
Feliz-style Fable bindings for Material-UI
Stars: ✭ 42 (-26.32%)
Mutual labels:  fable
Govalidator
Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.
Stars: ✭ 969 (+1600%)
Mutual labels:  request
Error Report
前端异常上报
Stars: ✭ 20 (-64.91%)
Mutual labels:  ajax
Ecommerce
We're going to take you step-by-step to build a modern, fully open-source, eCommerce web application using Python, Django, Bootstrap, Javascript, and more.
Stars: ✭ 980 (+1619.3%)
Mutual labels:  ajax
Springboot Beginner
🔰 📝 这可能是流程最清晰、代码最干净、注释最详细的 SpringBoot 入门项目咯,对于初学 SpringBoot 的同学非常具有参考与学习价值哟 ~
Stars: ✭ 51 (-10.53%)
Mutual labels:  ajax
Frisbee
🐕 Modern fetch-based alternative to axios/superagent/request. Great for React Native.
Stars: ✭ 1,038 (+1721.05%)
Mutual labels:  request
Populous
Populates a <select> with a remote JSON.
Stars: ✭ 40 (-29.82%)
Mutual labels:  ajax
Create Request
Apply interceptors to `fetch` and create a custom request function.
Stars: ✭ 34 (-40.35%)
Mutual labels:  request
Uploader
A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
Stars: ✭ 1,042 (+1728.07%)
Mutual labels:  ajax
Laravel Dusk Select2
Select2.js support for the Laravel Dusk testing
Stars: ✭ 31 (-45.61%)
Mutual labels:  ajax
Spring Web Rss Channels
A Full Stack RSS Reader web application built with Spring MVC and JSP. It uses libraries like Spring, JPA, Bootstrap, Apache Tiles, JSP etc. There is also a static code analysis tool called Checkstyle.
Stars: ✭ 40 (-29.82%)
Mutual labels:  ajax
Oh My Request
🔮 simple request library by java8
Stars: ✭ 44 (-22.81%)
Mutual labels:  request

Fable.SimpleHttp Build Status Build status Nuget

A library for easily working with Http in Fable projects.

Features

  • Extremely simple API for working with HTTP requests and responses.
  • Implemented in idiomatic F# Async (instead of promises which follow JS semantics)
  • Supports sending and receiving raw binary data (i.e.Blob in the browser)
  • Built on top of XMLHttpRequest available in all browsers (even IE11!) so it doesn't need the Fetch API nor it's associated polyfill.

Installation

Install from nuget using paket

paket add nuget Fable.SimpleHttp --project path/to/YourProject.fsproj

Usage

open Fable.SimpleHttp

// Functions from the Http module are all safe and do not throw exceptions

// GET request

async {
    let! (statusCode, responseText) = Http.get "/api/data"

    match statusCode with
    | 200 -> printfn "Everything is fine => %s" responseText
    | _ -> printfn "Status %d => %s" statusCode responseText
}

// POST request

async {
    let requestData = "{ \"id\": 1 }"
    let! (statusCode, responseText) = Http.post "/api/echo" requestData
    printfn "Server responded => %s" responseText
}

// Fully configurable request
async {
    let! response =
        Http.request "/api/data"
        |> Http.method POST
        |> Http.content (BodyContent.Text "{ }")
        |> Http.header (Headers.contentType "application/json")
        |> Http.header (Headers.authorization "Bearer <token>")
        |> Http.send

    printfn "Status: %d" response.statusCode
    printfn "Content: %s" response.responseText

    // response headers are lower cased
    response.responseHeaders
    |> Map.tryFind "content-length"
    |> Option.map int
    |> Option.iter (printfn "Content length: %d")
}


// Sending form data
async {
    let formData =
        FormData.create()
        |> FormData.append "firstName" "Zaid"
        |> FormData.append "lastName" "Ajaj"

    let! response =
        Http.request "/api/echo-form"
        |> Http.method POST
        |> Http.content (BodyContent.Form formData)
        |> Http.send

    printfn "Status => %d" response.statusCode
}


// Send and receive binary data with Blobs
// use FileReader module
async {
    let blob = Blob.fromText "input data"

    let! response =
       Http.request "/api/echoBinary"
       |> Http.method POST
       |> Http.content (BodyContent.Binary blob)
       |> Http.overrideResponseType ResponseTypes.Blob
       |> Http.send

    match response.content with
    | ResponseContent.Blob content ->
        let! blobContent = FileReader.readBlobAsText content
        printfn "Received content: %s" blobContent // "Received content: input data"

    | _ ->
        printfn "Unexpected response content"
}

Building and running tests

Requirements

  • Dotnet core 2.1+
  • Mono 5.0+
  • Node 10.0+

Watch mode: both client and server live

./build.sh Start

Running the the end-to-end tests

./build.sh Test

or just Ctrl + Shift + B to run the cli tests as a VS Code task

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].