You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
Just is a client-side HTTP library inspired by python-requests - HTTP for Humans.
Features
Just lets you to the following effortlessly:
URL queries
custom headers
form (x-www-form-encoded) / JSON HTTP body
redirect control
multipart file upload along with form values.
basic/digest authentication
cookies
timeouts
synchronous / asynchronous requests
upload / download progress tracking for asynchronous requests
link headers
friendly accessible results
Use
The simplest request with Just looks like this:
// A simple get request
Just.get("https://httpbin.org/get")
The next example shows how to upload a file along with some data:
// talk to registration end point
letr=Just.post("https://justiceleauge.org/member/register",
data:["username":"barryallen","password":"ReverseF1ashSucks"],
files:["profile_photo":.url(fileURLWithPath:"flash.jpeg",nil)])if r.ok { /* success! */ }
Here's the same example done asynchronously:
// talk to registration end point
Just.post("https://justiceleauge.org/member/register",
data:["username":"barryallen","password":"ReverseF1ashSucks"],
files:["profile_photo":.url(fileURLWithPath:"flash.jpeg",nil)]){ r inif r.ok { /* success! */ }}
Just includes dynamic framework targets for both iOS and OS X.
CocoaPods
The usual way:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'Just'
end
Manual
Drop Just.xcodeproj into your project navigator. Under the General tab of
your project settings, use the plus sign to add Just.framework to
Linked Framework and Libraries. Make sure to include the correct version
for your target's platform.
It's also common to add Just as a git submodule to your projects repository:
cd path/to/your/project
git submodule add https://github.com/dduan/Just.git
Source File
Put Just.swift directly into your project. Alternately, put it in the
Sources folder of a playground. (The latter makes a fun way to explore the
web.)
Contribute
Pull requests are welcome. Here are some tips for code contributors:
Work in Just.xcworkspace.
The tests for link headers relies on Github APIs, which has a low per-hour
limit. To overcome this, you can edit the Xcode build schemes and add
environment variablesGITHUB_TOKEN. Learn more about
personal tokens here.
For Xcode rebels, checkout Makefile.
HTML documentation pages are generated by literate programmin tool docco