Skip to content

Commit

Permalink
Set default script type to python
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric05 committed Mar 16, 2024
1 parent 1a208b4 commit 5236fe7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dothttp/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.43a11"
__version__ = "0.0.43a12"
6 changes: 3 additions & 3 deletions dothttp/models/parse_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ class ScriptType(enum.Enum):

@staticmethod
def get_script_type(script_type: LangOption):
if script_type == "python":
return ScriptType.PYTHON
else:
if script_type == "javascript":
return ScriptType.JAVA_SCRIPT
else:
return ScriptType.PYTHON
5 changes: 3 additions & 2 deletions examples/example.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GET https://req.dothttp.dev/user
"payload": {{$randomSlug}}
}
> {%
client.global.set("Server", response.headers.valueOf("Server"));
client.log('server is :'+ client.global.get('Server'));

def test_has_key_in_json():
assert client.response.status_code == 200, "Non 200 status code"
%}
2 changes: 1 addition & 1 deletion test/core/requests/script.http
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ client.test("check status", function(){
client.assert(response.status ===200, "status is 200")
})

%}
%} javascript


@name("python iter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ GET https://req.dothttp.dev/user
data("hai")
> {%
client.global.set("hai", response.headers.valueOf("hai"));
%}
%} javascript
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ client.test("check json", function(){
// were able to check json response
client.global.set("outputval", response.body);

%}
%} javascript
12 changes: 6 additions & 6 deletions test/extensions/commands/script.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ client.test("check json", function(){
// were able to check json response
client.global.set("outputval", response.body);

%}
%} javascript

@name("json_payload")
POST http://localhost:8000/post
Expand All @@ -30,7 +30,7 @@ client.test("check headers", function(){
// were able to check json response
client.global.set("outputval", response.body.json.token);
client.log("this is sample log");
%}
%} javascript



Expand Down Expand Up @@ -63,7 +63,7 @@ client.test("checks payload output recursive", function(){

});

%}
%} javascript


@name("delete property")
Expand All @@ -75,7 +75,7 @@ const value = client.global.get("setPropertyByfile");
console.log("value is `" + value+"`");
client.global.clear("setPropertyByfile");

%}
%} javascript


@name("script error")
Expand All @@ -85,7 +85,7 @@ GET http://localhost:8000/robots.txt

client.log(response.body.test.out);

%}
%} javascript



Expand All @@ -100,4 +100,4 @@ var bin = atob(b64);

console.log("value is `" + bin+"`");

%}
%} javascript
4 changes: 2 additions & 2 deletions test/extensions/test_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def test_more2(self):
(
(1215, "script.http"),
{
"start": 1189,
"end": 1436,
"start": 1211,
"end": 1469,
"type": "script",
"target": "isEquals check",
"target_base": None,
Expand Down

0 comments on commit 5236fe7

Please sign in to comment.