GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — superagent/superagent.min.js at master · bluntworks/superagent

Expand file tree

/

superagent.min.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
5 lines (5 loc) · 4.24 KB
/

superagent.min.js

Copy path

File metadata and controls

5 lines (5 loc) · 4.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
/*!
* superagent
* Copyright (c) 2010 TJ Holowaychuk <[email protected]>
* MIT Licensed
*/var superagent=function(exports){exports=request;var noop=function(){},getXHR="XMLHttpRequest"in this?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};function isFunction(obj){return obj&&obj.call&&obj.apply}function isObject(obj){var cons=obj.constructor;return cons&&"Object"==cons.name}function serialize(obj){if(!isObject(obj))return obj;var pairs=[];for(var key in obj)pairs.push(encodeURIComponent(key)+"="+encodeURIComponent(obj[key]));return pairs.join("&")}exports.serializeObject=serialize;function parseString(str){var obj={},pairs=str.split("&"),parts,pair;for(var i=0,len=pairs.length;i<len;++i)pair=pairs[i],parts=pair.split("="),obj[decodeURIComponent(parts[0])]=decodeURIComponent(parts[1]);return obj}exports.parseString=parseString,exports.types={html:"text/html",json:"application/json",urlencoded:"application/x-www-form-urlencoded"},exports.serialize={"application/x-www-form-urlencoded":serialize,"application/json":JSON.stringify},exports.parse={"application/x-www-form-urlencoded":parseString,"application/json":JSON.parse};function parseHeader(str){var lines=str.split(/\r?\n/),fields={},index,line,field,val;lines.pop();for(var i=0,len=lines.length;i<len;++i)line=lines[i],index=line.indexOf(":"),field=line.slice(0,index).toLowerCase(),val=line.slice(index+1).trim(),fields[field]=val;return fields}function Response(xhr,options){options=options||{},this.xhr=xhr,this.text=xhr.responseText,this.setStatusProperties(xhr.status),this.header=parseHeader(xhr.getAllResponseHeaders()),this.setHeaderProperties(this.header),this.body=this.parseBody(this.text)}Response.prototype.setHeaderProperties=function(header){var params=(this.header["content-type"]||"").split(/ *; */);this.contentType=params.shift(),this.setParams(params)},Response.prototype.setParams=function(params){var param;for(var i=0,len=params.length;i<len;++i)param=params[i].split(/ *= */),this[param[0]]=param[1]},Response.prototype.parseBody=function(str){var parse=exports.parse[this.contentType];return parse?parse(str):null},Response.prototype.setStatusProperties=function(status){var type=status/100|0;this.status=status,this.statusType=type,this.info=1==type,this.ok=2==type,this.clientError=4==type,this.serverError=5==type,this.error=4==type||5==type,this.noContent=204==status,this.badRequest=400==status,this.unauthorized=401==status,this.notAcceptable=406==status,this.notFound=404==status},exports.Response=Response;function Request(method,url){var self=this;EventEmitter.call(this),this.method=method,this.url=url,this.header={},this.set("X-Requested-With","XMLHttpRequest"),this.on("end",function(){self.callback(new Response(self.xhr))})}Request.prototype=new EventEmitter,Request.prototype.constructor=Request,Request.prototype.set=function(field,val){this.header[field.toLowerCase()]=val;return this},Request.prototype.type=function(type){this.set("Content-Type",exports.types[type]||type);return this},Request.prototype.data=function(data){this._data=data,isObject(data)&&!this.header["content-type"]&&this.type("json");return this},Request.prototype.send=function(data,fn){switch(arguments.length){case 2:return this.data(data).end(fn);case 1:return this.end(data);default:return this.end(noop)}},Request.prototype.end=function(fn){var self=this,xhr=this.xhr=getXHR(),data=this._data||null;this.callback=fn,xhr.open(this.method,this.url,!0);for(var field in this.header)xhr.setRequestHeader(field,this.header[field],!1);xhr.onreadystatechange=function(){4==xhr.readyState&&self.emit("end")};var serialize=exports.serialize[this.header["content-type"]];serialize&&(data=serialize(data)),null!=data&&!this.header["content-length"]&&this.set("Content-Length",data.length),xhr.send(data);return this},exports.Request=Request;function request(method,url){return new Request(method,url)}request.get=function(url,fn){var req=request("GET",url);fn&&req.end(fn);return req},request.del=function(url,fn){var req=request("DELETE",url);fn&&req.end(fn);return req},request.post=function(url,data,fn){var req=request("POST",url);data&&req.data(data),fn&&req.end(fn);return req},request.put=function(url,data,fn){var req=request("PUT",url);data&&req.data(data),fn&&req.end(fn);return req};return exports}({})
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.