@@ -164,6 +164,10 @@ public enum NSURLRequestNetworkServiceType : UInt {
164
164
*/
165
165
public class NSURLRequest : NSObject , NSSecureCoding , NSCopying , NSMutableCopying {
166
166
167
+ private var _URL : NSURL ?
168
+ private var _mainDocumentURL : NSURL ?
169
+ private var _httpHeaderFields : [ String : String ] ?
170
+
167
171
public func copyWithZone( zone: NSZone ) -> AnyObject {
168
172
NSUnimplemented ( )
169
173
}
@@ -180,6 +184,8 @@ public class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopyin
180
184
NSUnimplemented ( )
181
185
}
182
186
187
+ private override init ( ) { }
188
+
183
189
/*!
184
190
@method requestWithURL:
185
191
@abstract Allocates and initializes an NSURLRequest with the given
@@ -219,14 +225,17 @@ public class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopyin
219
225
@param URL The URL for the request.
220
226
@result An initialized NSURLRequest.
221
227
*/
222
- public convenience init ( URL: NSURL ) { NSUnimplemented ( ) }
228
+ public convenience init ( URL: NSURL ) {
229
+ self . init ( )
230
+ _URL = URL
231
+ }
223
232
224
233
/*!
225
234
@method URL
226
235
@abstract Returns the URL of the receiver.
227
236
@result The URL of the receiver.
228
237
*/
229
- /*@NSCopying */public var URL : NSURL ? { NSUnimplemented ( ) }
238
+ /*@NSCopying */public var URL : NSURL ? { return _URL }
230
239
231
240
/*!
232
241
@method mainDocumentURL
@@ -236,14 +245,14 @@ public class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopyin
236
245
See setMainDocumentURL:
237
246
@result The main document URL.
238
247
*/
239
- /*@NSCopying*/ public var mainDocumentURL : NSURL ? { NSUnimplemented ( ) }
248
+ /*@NSCopying*/ public var mainDocumentURL : NSURL ? { return _mainDocumentURL }
240
249
241
250
/*!
242
251
@method HTTPMethod
243
252
@abstract Returns the HTTP request method of the receiver.
244
253
@result the HTTP request method of the receiver.
245
254
*/
246
- public var HTTPMethod : String ? { get { NSUnimplemented ( ) } }
255
+ public var HTTPMethod : String ? { get { return " GET " } }
247
256
248
257
/*!
249
258
@method allHTTPHeaderFields
@@ -252,7 +261,7 @@ public class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopyin
252
261
@result a dictionary containing all the HTTP header fields of the
253
262
receiver.
254
263
*/
255
- public var allHTTPHeaderFields : [ String : String ] ? { NSUnimplemented ( ) }
264
+ public var allHTTPHeaderFields : [ String : String ] ? { return _httpHeaderFields }
256
265
257
266
/*!
258
267
@method valueForHTTPHeaderField:
@@ -264,7 +273,7 @@ public class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopyin
264
273
@result the value associated with the given header field, or nil if
265
274
there is no value associated with the given header field.
266
275
*/
267
- public func valueForHTTPHeaderField( field: String ) -> String ? { NSUnimplemented ( ) }
276
+ public func valueForHTTPHeaderField( field: String ) -> String ? { return _httpHeaderFields ? [ field . lowercaseString ] }
268
277
269
278
}
270
279
0 commit comments