public async Task Start() { string file = await HttpRequestInteractions.GetBodyKey(Request, "x-recording-file", true); string recordingId = RecordingHandler.GetHeader(Request, "x-recording-id", true); if (String.IsNullOrEmpty(file) && !String.IsNullOrEmpty(recordingId)) { await _recordingHandler.StartPlaybackAsync(recordingId, Response, RecordingType.InMemory); } else if (!String.IsNullOrEmpty(file)) { await _recordingHandler.StartPlaybackAsync(file, Response, RecordingType.FilePersisted); } else { throw new HttpException(HttpStatusCode.BadRequest, "At least one of either JSON body key 'x-recording-file' or header 'x-recording-id' must be populated when starting playback."); } }
public async Task Start() { string file = await HttpRequestInteractions.GetBodyKey(Request, "x-recording-file", allowNulls : true); _recordingHandler.StartRecording(file, Response); }