From 3c412fe6476f378fd5eb1d681512bd96f2b04925 Mon Sep 17 00:00:00 2001 From: "Jonathan S. Fisher" Date: Mon, 27 May 2019 13:02:03 -0500 Subject: [PATCH] Fix: PUT support https://github.com/sonatype-nexus-community/nexus-repository-apt/issues/114 --- .../apt/internal/hosted/AptHostedHandler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/staticsnow/nexus/repository/apt/internal/hosted/AptHostedHandler.java b/src/main/java/net/staticsnow/nexus/repository/apt/internal/hosted/AptHostedHandler.java index d39d710..e4a54f9 100644 --- a/src/main/java/net/staticsnow/nexus/repository/apt/internal/hosted/AptHostedHandler.java +++ b/src/main/java/net/staticsnow/nexus/repository/apt/internal/hosted/AptHostedHandler.java @@ -1,8 +1,8 @@ /* * Nexus APT plugin. - * + * * Copyright (c) 2016-Present Michael Poindexter. - * + * * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. * @@ -14,6 +14,7 @@ import static org.sonatype.nexus.repository.http.HttpMethods.GET; import static org.sonatype.nexus.repository.http.HttpMethods.HEAD; import static org.sonatype.nexus.repository.http.HttpMethods.POST; +import static org.sonatype.nexus.repository.http.HttpMethods.PUT; import java.io.IOException; @@ -55,7 +56,9 @@ public Response handle(Context context) throws Exception { hostedFacet.rebuildIndexes(); return HttpResponses.ok(); } - else if (path.equals("")) { + } + case PUT: { + if (path.equals("")) { hostedFacet.ingestAsset(context.getRequest().getPayload()); return HttpResponses.created(); } @@ -65,7 +68,7 @@ else if (path.equals("")) { } default: - return HttpResponses.methodNotAllowed(method, GET, HEAD, POST); + return HttpResponses.methodNotAllowed(method, GET, HEAD, POST, PUT); } }