Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aabssmc committed Mar 9, 2024
1 parent 36fd733 commit 3d4b2c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/main/java/lol/aabss/skhttp/elements/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Types {
static {
Expand Down Expand Up @@ -59,7 +60,7 @@ public boolean canParse(@NotNull ParseContext context) {
)
);

Classes.registerClass(new ClassInfo<>(HttpRequest.class, "httpresponse")
Classes.registerClass(new ClassInfo<>(HttpResponse.class, "httpresponse")
.name("Http Response")
.description("Represents an http response.")
.user("http ?requests?")
Expand All @@ -72,13 +73,13 @@ public boolean canParse(@NotNull ParseContext context) {
}

@Override
public @NotNull String toString(HttpRequest o, int flags) {
public @NotNull String toString(HttpResponse o, int flags) {
return toVariableNameString(o);
}

@Override
public @NotNull String toVariableNameString(HttpRequest o) {
return "http request";
public @NotNull String toVariableNameString(HttpResponse o) {
return "http response";
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class SecRequestBuilder extends Section {

static {
Skript.registerSection(SecRequestBuilder.class,
"[a] [new] http request [builder]"
"http request [builder]"
);
ENTRY_VALIDATOR.addEntryData(new ExpressionEntryData<>("url", null, false, String.class));
ENTRY_VALIDATOR.addEntryData(new ExpressionEntryData<>("method", null, false, String.class));
Expand All @@ -64,10 +64,8 @@ public boolean init(Expression<?> @NotNull [] exprs, int matchedPattern, @NotNul
this.method = (Expression<String>) container.getOptional("method", false);
if (this.method == null) return false;
this.body = (Expression<String>) container.getOptional("body", false);
if (this.body == null) return false;
this.headers = (Expression<String>) container.getOptional("headers", false);
if (this.headers == null) return false;
var = (Variable<?>) container.getOptional("variable", false);
this.var = (Variable<?>) container.getOptional("variable", false);
return var != null;
}

Expand Down

0 comments on commit 3d4b2c7

Please sign in to comment.