Added PostFrame, extract eventargs
This commit is contained in:
11
net/events/EventArgs.js
Normal file
11
net/events/EventArgs.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
class EventArgs
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this.Handled = false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EventArgs;
|
36
net/events/HttpRequestComplete.js
Normal file
36
net/events/HttpRequestComplete.js
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
var EventArgs = require( "./EventArgs" );
|
||||
|
||||
class HttpRequestComplete extends EventArgs
|
||||
{
|
||||
constructor( Response, ResponseData )
|
||||
{
|
||||
super();
|
||||
|
||||
if( ResponseData === undefined )
|
||||
{
|
||||
this.statusCode = -1;
|
||||
this.Data = new Buffer( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.statusCode = Response.statusCode;
|
||||
this.Data = ResponseData;
|
||||
}
|
||||
|
||||
this.Response = Response;
|
||||
}
|
||||
|
||||
get Headers()
|
||||
{
|
||||
return this.Response.headers;
|
||||
}
|
||||
|
||||
get ResponseString()
|
||||
{
|
||||
return this.Data.toString( "utf-8" );
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HttpRequestComplete;
|
20
net/events/PostRequest.js
Normal file
20
net/events/PostRequest.js
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var qstr = require( "querystring" );
|
||||
var EventArgs = require( "./EventArgs" );
|
||||
|
||||
class PostRequestEventArgs extends EventArgs
|
||||
{
|
||||
constructor( QueryString )
|
||||
{
|
||||
super();
|
||||
this.Raw = QueryString;
|
||||
}
|
||||
|
||||
get Data()
|
||||
{
|
||||
return qstr.parse( this.Raw );
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PostRequestEventArgs;
|
Reference in New Issue
Block a user