private async Task PostCredentials(S3Context ctx) { if (ctx.Http.Request.Url.Elements.Length != 2) { await ctx.Response.Send(S3ServerInterface.S3Objects.ErrorCode.InvalidRequest); return; } byte[] data = null; Credential cred = null; try { data = Common.StreamToBytes(ctx.Request.Data); cred = Common.DeserializeJson <Credential>(data); } catch (Exception) { await ctx.Response.Send(S3ServerInterface.S3Objects.ErrorCode.InvalidRequest); return; } Credential tempCred = _Config.GetCredentialByAccessKey(cred.AccessKey); if (tempCred != null) { ctx.Response.StatusCode = 409; ctx.Response.ContentType = "text/plain"; await ctx.Response.Send(); return; } _Config.AddCredential(cred); ctx.Response.StatusCode = 201; ctx.Response.ContentType = "text/plain"; await ctx.Response.Send(); }