BLIP/BLIPRequest.m
changeset 14 bb5faa9995d5
parent 1 8267d5c429c4
child 18 3be241de1630
     1.1 --- a/BLIP/BLIPRequest.m	Sat May 24 13:26:02 2008 -0700
     1.2 +++ b/BLIP/BLIPRequest.m	Wed Jun 04 21:09:45 2008 -0700
     1.3 @@ -103,9 +103,25 @@
     1.4      return _response != nil;
     1.5  }
     1.6  
     1.7 -- (void) respondWithData: (NSData*)data                   {self.response.body = data; [self.response send];}
     1.8 -- (void) respondWithString: (NSString*)string             {[self respondWithData: [string dataUsingEncoding: NSUTF8StringEncoding]];}
     1.9 -- (void) respondWithError: (NSError*)error                {self.response.error = error; [self.response send];}
    1.10 +- (void) respondWithData: (NSData*)data contentType: (NSString*)contentType
    1.11 +{
    1.12 +    BLIPResponse *response = self.response;
    1.13 +    response.body = data;
    1.14 +    response.contentType = contentType;
    1.15 +    [response send];
    1.16 +}
    1.17 +
    1.18 +- (void) respondWithString: (NSString*)string
    1.19 +{
    1.20 +    [self respondWithData: [string dataUsingEncoding: NSUTF8StringEncoding]
    1.21 +              contentType: @"text/plain; charset=UTF-8"];
    1.22 +}
    1.23 +
    1.24 +- (void) respondWithError: (NSError*)error
    1.25 +{
    1.26 +    self.response.error = error; 
    1.27 +    [self.response send];
    1.28 +}
    1.29  
    1.30  - (void) respondWithErrorCode: (int)errorCode message: (NSString*)errorMessage
    1.31  {